socket help
how to create a socket ( in dev c++ 4.9.9.2) between my comp and 64.233.187.99 (which is google.com)
i tried
SOCKET sockfd;
sockfd=socket(AF_INET,SOCK_STREAM,0);
but does not know the meaning of various arguments i.e where to specify the ip address
can anybody help please
thanks in advance
This is a very good tutorial concerning linux sockets.
http://beej.us/guide/bgnet/
The socket() just creates a file descriptor.
Then you have to use the bind() command in which you give the ip and port number.
The tutorial says it all :P
http://beej.us/guide/bgnet/
The socket() just creates a file descriptor.
Then you have to use the bind() command in which you give the ip and port number.
The tutorial says it all :P
thanks for the links
i have another question ( i am actually a beginner in networks)
can two networks placed far apart in different towns can be connected by a router
also is something exists like this == ip address of a router .if it exists , then what does it mean
again remember ( i am actually a beginner in networks so questions may be strange)
i have another question ( i am actually a beginner in networks)
can two networks placed far apart in different towns can be connected by a router
also is something exists like this == ip address of a router .if it exists , then what does it mean
again remember ( i am actually a beginner in networks so questions may be strange)
Quote:Original post by mnbvlkBeej's Guide is 99.9% relevant to WinSock too. The only differences I can think of offhand are that you need to call WSAStartup before making any socket calls, and the first argument to select() is ignored in WinSock.
sorry , i forget to tell that iam working on windows xp and not linux
Quote:Original post by mnbvlk
thanks for the links
i have another question ( i am actually a beginner in networks)
can two networks placed far apart in different towns can be connected by a router
also is something exists like this == ip address of a router .if it exists , then what does it mean
again remember ( i am actually a beginner in networks so questions may be strange)
are my questions strange??????????
Quote:Original post by mnbvlkYes they can. Although they're likely to be connected by several routers (This is essentially how the Internet works).
can two networks placed far apart in different towns can be connected by a router
Quote:Original post by mnbvlkI don't quite understand what you mean. Your external IP is assigned by your ISP, and your internal LAN IP is assigned by your router (Assuming you have DHCP enabled). If you're asking if there's a way to get the IP of your router, then yes - you can get the default gateway through some Winsock calls. But that'll be your router's internal LAN IP (E.g. 192.168.0.1), not it's external IP as other machines see it.
also is something exists like this == ip address of a router .if it exists , then what does it mean
Original post by Evil SteveQuote:Original post by mnbvlkYes they can. Although they're likely to be connected by several routers (This is essentially how the Internet works).
can two networks placed far apart in different towns can be connected by a router
will there be several routers even if the networks is a private lan spread all over a city or just a single router
Quote:Original post by mnbvlkDepends on the network. Although almost definitely - one router won't really be able to cope well with hundreds or thousands of connections.
will there be several routers even if the networks is a private lan spread all over a city or just a single router
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement