there are two simple program to demo the unix domain DGRAM socket. and the following is the result: it seems like nothing wrong here. but, I get nothing from the server. I don’t know why it can’t run as I expect. Answer You should be sending to /var/run/lsvr.sock not to /var/run/lcli.sock. Also you don’t have to bind in client so
Tag: sockets
Can’t listen on IPv4 and IPv6 together (address already in use)
I don’t think the precise code is important. Instead, I’ll give the strace output: We can see that socket 5 (IPv4) successfully bound to port any:31337, but when I try to bind socket 6 (IPv6), it fails with EADDRINUSE. You can also see that I did set SO_REUSEADDR on both sockets, so I believe this problem should not have happened.
IPv6 multicast interface selection
The setsockopt way to select an interface for the outgoing traffic with IPv4 is IP_MULTICAST_IF, which accepts two arguments. From the ip(4) manual page: Set the local device for a multicast socket. The argument for setsockopt(2) is an ip_mreqn or (since Linux 3.5) ip_mreq structure similar to IP_ADD_MEMBERSHIP, or an in_addr structure. When trying to do the analogous operation with
setsockopt usage in Linux and Solaris [Invalid argument in Solaris]
I’m trying to use setsockopt() on both Linux and Solaris in my ftp program. Linux uses a long for optvalue as a parameter, but Solaris uses a char instead. The program works fine in Linux, but reports “Invalid argument” in Solaris when creating the socket. Answer There are 2 issues appearing in the question: Linux uses a long for optvalue
One way communication over TCP Socket [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago. Improve this question I am trying to send some data to a remote Raspberry Pi over TCP socket from a GUI that I designed with Python. I’ve implemented
Java – AttachNotSupportedException: Unable to open socket file: HotSpot VM not loaded
When attempting to attach an agent jar file onto another process running in java, I have came across the exception: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded I was running linux, with java Oracle JDK 8_101, however after answering this question I’ve realized the O.S does not matter for the cause of
SIGPIPE in C++ determining which TCP socket is disconnected
I’m using Linux/Ubuntu. I’ve written a pair of classes that implement a TCP server and TCP client, respectively. Part of the code is to have graceful recovery from disconnects. My only problem is with SIGPIPE. I’ve written code to capture the signal, but I’d like it to start the “attempt to reconnect” process on the class instance that hit the
What is the expected behaviour if file is written/altered while sendfile() is in progress
One thread writes to a file (or even delete it), another one calls sendfile() for that file simultaneously for overlapping positions. What is the expected behaviour here? Also, If my understanding is correct, sendfile call will just add a record to socket (file description, position, length) and return to caller. (no copy to socket’s buffer yet?), so even sendfile() returns
Sending to a Datagram socket, without blocking indefinitely
We have some code to send metrics to a SOCK_DGRAM where another daemon listens and aggregates/proxies these messages. Opening the socket looks like: And at the moment we write to it like: I want to ensure the call above doesn’t block for very long (or at the very least doesn’t block indefinitely), but my understanding of unix sockets is not
C Threaded Sockets – tcp with TLS, Can’t get ip/ether packet headers
thanks for reading this question. Have been working for a while on C sockets – specifically c threaded tcp sockets with tls. Using the Openssl API. I have been facing an issue for some time now where I can get the source IP and Port – e.g printf(“Connection: %s:%dn”,inet_ntoa(d->addr.sin_addr), ntohs(d->addr.sin_port));. The problem is that I need all the data –