Hi, I'm pretty new at programming and esp network programming so if it's stupid, don't bash too hard please, thanks.
I have client and server communicating with diagrams (UDP) in C. client sends 5 msgs and upon receiving msgs, server sends msgs back. receiving and sending messages are great until client has finished receiving the msgs. after server sending all msgs back, it terminates using close(). so recvfrom() from client should return 0, right?
assuming recvfrom() should return 0 upon close() from server side, it returns -1 instead, with error Resource temporarily unavailable. is this resource reference to closed socket from server? or is it for something else entirely different like running out of buffer or something (which i don't think is true)?
and assuming my assumption was wrong and -1 is returned because server terminated, i probably should handle the error with
if(SOMEMACRO)
do something
but how do i find out what SOMEMACRO
is? i print out the error but it says resource temp unavailable and recvfrom() description doesn't mention about unavilable resource..?
btw this is a non blocking socket, if that makes any difference since i read that if O_NONBLOCK is set and no msgs are available, it would set errno to EAGAIN or EWOULDBLOCK. O_NONBLOCK isn't set but MSG_DONTWAIT is set. are they basically the same thing where O_NONBLOCK is for general file descriptors and MSG_DONTWAIT is socket specific??
My brain isn't working all that great now, if someone could enlighten me and clarify what my confusion is about, i would deeply appreciate it. Thanks!