UDP Client
-
Hi everyone, I have a UDP client running. I wanted to know if I can use the flag MSG_PEEK when doing a Receive. I keep getting an error (WSAEMSGSIZE (10040)) which says the message is too long. What is currently in the buffer is a 12 bytes message. I want to just peek at the first 4 bytes so that I know how to process it. I have a temp buffer declared as 4 bytes to store and determine what kind of message it is, but it keeps reading all 12 bytes, trancating, and returning an error. What I want it to do is peek at the buffer and then process each type of message. In the process method of each type, that is where I would like to take the info out the buffer. I do this same method for TCP client and it works fine. What should I be doing to have this perform like I want and how I have it in my TCP client app? Thanks in advance. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
-
Hi everyone, I have a UDP client running. I wanted to know if I can use the flag MSG_PEEK when doing a Receive. I keep getting an error (WSAEMSGSIZE (10040)) which says the message is too long. What is currently in the buffer is a 12 bytes message. I want to just peek at the first 4 bytes so that I know how to process it. I have a temp buffer declared as 4 bytes to store and determine what kind of message it is, but it keeps reading all 12 bytes, trancating, and returning an error. What I want it to do is peek at the buffer and then process each type of message. In the process method of each type, that is where I would like to take the info out the buffer. I do this same method for TCP client and it works fine. What should I be doing to have this perform like I want and how I have it in my TCP client app? Thanks in advance. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
With UDP sockets you have to call ReceiveFrom instead of Receive. Thats why it works with TCP. Bunburry