I am new to programming and network programming, so if this is stupid, not too bash, please, thanks.
I have a client and a server that interact with charts (UDP) in C. client sends 5 msgs, and when I receive messages, the server sends messages back. receiving and sending messages is great until the client finishes receiving messages. after the server sends all messages back, it exits using the close () function. so recvfrom () from the client should return 0, right?
Assuming that recvfrom () should return 0 when closing () on the server side, instead it returns -1, and the resource error is temporarily unavailable. Is this a resource link for a private socket from the server? or is it for something else, completely different, like running from a buffer or something (that I don’t think is true)?
and assuming my assumption was wrong and -1 is returned because the server is finished, I probably should handle the error with
if(SOMEMACRO) do something
but how do you know what is SOMEMACRO ? I print an error, but it says that the temp resource is unavailable and recvfrom () in the description does not mention an unusable resource ..?
btw is a non-blocking socket, if that makes any difference, as I read that if O_NONBLOCK is set and no msgs are available, it will set errno to EAGAIN or EWOULDBLOCK. O_NONBLOCK is not installed, but MSG_DONTWAIT is installed. is it basically the same as O_NONBLOCK for shared file descriptors, and is MSG_DONTWAIT a specific socket ??
My brain is not working so well right now, if someone can enlighten me and find out what my confusion is, I would really appreciate it. Thanks!
c udp sockets client
Fantasy fourier
source share