|
-
April 26th, 2023, 10:53 PM
#1
UDP socket , client side
In UDP communication when I send a packet from client I execute the socket() system call but I didn't understand if It's necessary to follow the bind()one too.
client side
Case A:
socket(...)
bind(...)
sendto(...)
Case B:
socket(...)
sendto(...)
It's right A or B or both cases ?
Peraphs if I omit bind() the O.S. automatically executes It ?
Bind links socket to ip address+port, so according my opinion this task should be execute from each client too, because clients in TCP/UDP communication use IP+port. What do you think ?
Thanks
Last edited by zio_mangrovia; April 26th, 2023 at 10:58 PM.
-
April 27th, 2023, 03:25 AM
#2
Re: UDP socket , client side
AFAIK, bind() is used on the server side, not on the client one, For the client there are the following steps to create a socket and communicate: Winsock Client Application
Victor Nijegorodov
-
April 27th, 2023, 09:12 AM
#3
Re: UDP socket , client side
 Originally Posted by VictorN
AFAIK, bind() is used on the server side, not on the client one, For the client there are the following steps to create a socket and communicate
Perhaps on client side, O.S. associates IP+Port to socket because client socket end has to get IP with an ephemeral port to send data by nuetwork, if you use bind() you will specify exactly these data (if you have multiple interface or specific port over 1024) which will bring forward from O.S.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|