Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bind Socket to certain local addr and port

Status
Not open for further replies.

vvv

Programmer
Jan 11, 2001
7
0
0
KR
i tried to bind inet socket to predefined address and port (it's server with multi ip's), but it succedeed only in binding to port
what's wrong?
i used sth like this

$myport=20000;
$myip="34.34.34.34";

$proto=getprotobyname('tcp');
socket(SOCK,PF_INET,SOCK_STREAM,$proto);
$iaddr1=$inet_aton($myip);
$paddr1=$sockaddr_in($iaddr1,$myport);
$bind(SOCK,$paddr1);
 
$bind(SOCK,$paddr1);

should be:

bind(SOCK,$paddr1); adam@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top