Problem in socket_connect() function

PuLs333

New Member
\[code\]// Create a new socket$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);// An example list of IP addresses owned by the computer$sourceips['kevin'] = '127.0.0.1';$sourceips['madcoder'] = '127.0.0.2';// Bind the source addresssocket_bind($sock, $sourceips['madcoder']);// Connect to destination addresssocket_connect($sock, $sourceips['madcoder'], 80);// Write$request = 'GET / HTTP/1.1' . "\r\n" . 'Host: example.com' . "\r\n\r\n";socket_write($sock, $request);// Closesocket_close($sock);\[/code\]I am getting an error \[quote\] Warning: socket_connect() [function.socket-connect]: unable to connect [0]: A socket operation was attempted to an unreachable host. in C:\wamp\www\sockert\sockert.php on line 13\[/quote\]Thanks,
 
Back
Top