|
-
October 14th, 2003, 09:59 AM
#2
Using BSD style sockets ...
1. create socket using "socket()", specify AF_INET for the address family, IP_PROTO for protocol (I think), and SOCK_STREAM for TCP socket (SOCK_DGRAM for UDP)
2. optionally "bind()" the socket to a local interface.
3. connect the socket to the remote host.
4. use send() to send data and recv() to receive data.
5. calls normally block but you can enable non-blocking IO and use select() to determine which data has arrived or socket is ready to send again.
Plenty of code samples for the above online.
-rick
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
|