![]() |
|
|
|||||||
![]() |
C Programming - Re: How to format/send/receive UDP packet in C? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Abby wrote:
> I'd like to ask about how to format/send/receive UDP datagram packet > in C language. The server that I'd like to send the packet to is > listening on port 1500. When I succesfully connect to that port, it's > gonna create and send a packet back to the client. The only code I > need to write is the client-side code. The problem is, I don't have > any idea how to: > > 1. Send data packet to server (I'm going to send the data in Hex > format) > 2. Receive data back from that server > > I also don't have any idea how to format the packet. Please give me a > simple explanation. Thank you so much. > > PS. I searched for example code, but I got only the one that show me > how to send packet to server. No code show me how to also receive the > packet. This is wildly off topic for clc but what the heck. UDP is connectionless. You send packets but you don't actively make a stateful connection with the destination [e.g. no way to know if it gets there]. To receive UDP packets you have to be listening [e.g. bind to a UDP port]. Tom Tom St Denis |
|
|