views:

154

answers:

1

o Sun OS, UTS, AIX etc. But, when the same program is run with HP UX on the other end, we are unable to receive the response from the HP UX box (B.11.31 O/S).

sSocket = socket(AF_INET,SOCK_STREAM,0); 
connect(sSocket,(struct sockaddr *)&sin,sizeof(sin); 
ierr = read(sSocket,szBuffer,BUF_LEN-1);

When the read is called, we get junk messages like this

Message received :ÿý$ 
Message received :ÿýÿþÿý 
Message received :ÿü!ÿû

This code was working for all the other OSs like I stated earlier. Can somebody explain why this is happening. Note: We are able to login to HP box manually using telnet.

+4  A: 

These are telnet commands. Specifically "ÿ" is the Latin-1 graphic corresponding to the TELNET IAC (Interpret as Command) character, "ý" is the DO command, and "$" is the old ENVIRON option. It is intended that you send a WILL or WONT response. See the TELNET specification in RFC 854 for details.

I believe that some telnet servers do not send telnet commands until the client sends them first, which may explain why you do not see the issue with some servers.

mark4o