||12-13-2006 07:40 PM
recv: Bad address (UNIX Socket programming)
I'm working on sending messages from a client program to a server using UNIX domain sockets. I am using send and recv to pass messages.
I have a pointer to an array of char pointers...
* Fill the array with strings appropriately...
Later, I try to send this pointer from my client to my server like so:
int send_status = send(socket_descriptor, args, sizeof(args), FLAGS);
On the server side, I am receiving the message like this:
message_length = recv(connected_socket_descriptor, str, MESSAGE_SIZE, FLAGS);
Everything compiles fine, but when I eventually try to pass a message from my client to my server I get the error message
Thanks to Google Groups
, I was able to determine that
...the message refers to the address of the receive buffer.
Perhaps you have an uninitialized pointer?
Which means that str in my server's recv command is somehow uninitialized. What does that mean? How can I avoid fix it? How can I avoid it in the future?