Socket initialisation code lines
| Daniel A (7) | |||
| Hi volks, Could anyone tell me what does every line mean and why it has to be used? The only thing I know that it is about socket programming :) addr_.sin_family = AF_INET; 101 addr_.sin_port = 0; 102 addr_.sin_addr.s_addr = INADDR_ANY; Thanks in advance.. Dan | |||
| Umz (153) | |||
| This document explains socket programming quite well www.rites.uic.edu/~solworth/sockets.pdf | |||
| bnbertha (404) | |||
| These three lines set up a structure for configuring a network socket, in this case a TCP/IP or UDP socket. The first one sets the protocol, in this case IPv4 The second one sets the network port to use (zero) and the third sets the IP address. In this case you don't care, letting the OS do it for you. These three setting are typically used in the bind() call on a local socket. Hope this helps | |||
| Daniel A (7) | |||
| Thanks!!!! That's really helpfull :) | |||
This topic is archived - New replies not allowed.
