So, I’m trying to write some JNA code to work with Unix sockets, and I’m trying to reference AF_UNIX for sockets. I looked through some of the gcc included files, but I couldn’t find anything. Answer On my Ubuntu-machine it is defined in /usr/include/x86_64-linux-gnu/bits/socket.h as 1. I haven’t checked around in other Unix source trees, but I have a feeling
Tag: sockets
Linux Socket Bad File Descriptor
I couldn’t find a duplicate, so I decided to post. We’re getting into Sockets (beginner-level) now, and was given the code below to make the client send a simple message to the server by using send() and recv(). However, everything I have tried doesn’t seem to get rid of the error: Bad File Descriptor and newsockfd always returns the value
When using PF_PACKET type of socket, what does PACKET_ADD_MEMBERSHIP?
When using a PF_PACKET type of socket with protocol type ETH_P_IP, the man packet documentation talks about a socket option for multicast. The socket option is PACKET_ADD_MEMBERSHIP. Assuming you use PACKET_ADD_MEMBERSHIP socket option on a PF_PACKET socket correctly, what features and benefits and use cases is this socket option for? Right now I receive all incoming IP packets so I
errno after accept in Linux socket programming
As stated in accept() man page in RETURN VALUE section: Error handling Linux accept() (and accept4()) passes already-pending network errors on the new socket as an error code from accept(). This behavior differs from other BSD socket implementations. For reliable operation the application should detect the network errors defined for the protocol after accept() and treat them like EAGAIN by
Cannot send or receive packets from my VirtualBox debian linux VM using UDP
For the sake of simplicity, I will refer you to http://en.wikipedia.org/wiki/Berkeley_sockets and the UDP server and client source code there. I am trying to send a packet using UDP protocol to a linux VirtualMachine server program. Both my host and VM ping well; all packets sent are received in both directions. However my server program is either not receiving any
OS X UDP send error: 55 No buffer space available
While I was implementing RUDP in python3.3 on OSX10.9.1 I noticed that the following code actually does not do what it does on linux: (it doesn’t matter which language, same behavior for C, Java and C#/Mono) This code just keep writing a lot udp packets to 8.8.8.8, those packets get dropped after 4 hops so they should not reach the
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
I just manually installed a new plugin on my WordPress site, created a table in MySQL for the plugin’s entries, and when I try to open the page that uses the plugin, I receive this error: This is the MySQL info listed in my config file (which I believe is correct): This is the main contents of the /etc/my.cnf file:
Combining sento() write writev()?
I’ve set a udp socket and call sendto() with a different recipient at each call. I would like to use writev() in order to benefit scater/gather io but writev() does not allows me to specify the recipient addr/port as in sendto(). Any suggestions? Answer You can use writev to send a coalesced set of buffers to a single end point
How to receive a file using sendfile?
send a file with sendfile is easy: but how to receive a file using sendfile? since I don’t know the length of the file, should I send the file length first? There seems to be two ways of doing this: send the filestat.len first use a loop in the receive end: Which one is better? Should I handle the buffer
Minimizing copies when writing large data to a socket
I am writing an application server that processes images (large data). I am trying to minimize copies when sending image data back to clients. The processed images I need to send to clients are in buffers obtained from jemalloc. The ways I have thought of sending the data back to the client is: 1) Simple write call. 2) I obtain