in reply to bind a client connection
bind(SOCKET, pack_sockaddr_in(0, inet_aton($local_ip)))
It's exactly the same as when you're setting up a server except that you're calling connect rather than listen
(... and the point of using pack_sockaddr_in is so that you don't have to create extra variables you don't need. Unlike with sockaddr_in which looks at its context to see whether it should be packing or unpacking, pack_sockaddr_in always packs... and you could do that with the connect() call as well to get rid of $iaddr and $paddr...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: bind a client connection
by Anonymous Monk on Feb 11, 2012 at 22:29 UTC | |
by wrog (Friar) on Feb 12, 2012 at 00:25 UTC | |
by Anonymous Monk on Feb 12, 2012 at 00:34 UTC |