I checked this forum for answers found a few but it doesnt work. I have a service running on a remote machine listening for tcp/ip connections. I want to connect to this service using sockets, this i can do, but the problem comes when i send data to the service. My service uses a readln function to get the data, php only has a write function for sockets. This means there is no carriage return. I aded a carraige return to the command im sending but the service still cant recognise it. Need help please.
[code=php]
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$result = socket_connect($socket,’172.1.103.2′,6667);
$Str = ‘REL’.chr(13);
$bytes = socket_write($socket,$Str);
if ($bytes == 0)
echo(‘No data were sent’);
else
echo($bytes.’ bytes of data were sent’);
//$ret = Socket_read($socket,1024);
//echo $ret;
socket_close($socket);