incloming socket address
-
I have socket server and i would want to know, how to print client sockets address to screen. Is there so function, that makes it to normal ip address form (e.x 120.1.1.2)
-
I have socket server and i would want to know, how to print client sockets address to screen. Is there so function, that makes it to normal ip address form (e.x 120.1.1.2)
getpeername(...) Rickard Andersson@Suza Computing ICQ#: 50302279 (Add me!) E-mail: nikado@pc.nu I'm from the winter country SWEDEN!
-
I have socket server and i would want to know, how to print client sockets address to screen. Is there so function, that makes it to normal ip address form (e.x 120.1.1.2)
inet_ntoa(from.sin_addr)
Nish p.s. from is a sockaddr_in
Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.
-
I have socket server and i would want to know, how to print client sockets address to screen. Is there so function, that makes it to normal ip address form (e.x 120.1.1.2)
-
I have socket server and i would want to know, how to print client sockets address to screen. Is there so function, that makes it to normal ip address form (e.x 120.1.1.2)
It goes like this : if((new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size)) == -1) { perror("accept"); } printf("server: got connection from %s\n", inet_ntoa(their_addr.sin_addr)); The remote adrese is returned by the secondn parameter of 'accept' function Bye, Orbital^ ...the night is long ... but not long enought to do some real coding ...
-
I have socket server and i would want to know, how to print client sockets address to screen. Is there so function, that makes it to normal ip address form (e.x 120.1.1.2)
Thanks to you all