in reply to C Client / Perl Server incompatibility

The problems is because your C code is not sending a newline, yet in the perl server you are reading with '<>' the '<>' reads a line without the \n it keeps on reading. Change the server to use sysread rather than <>. You always send 3 chars so just sysread 3 chars. UPDATE: The c code looks 'odd' OK: You have two loops reading G E T within each other .. this cant be right. The outer loop does nothing? Other than cause the ip to be entered twice and print the greeting twice. There are a couple of lines: len = read(sockfd,buffer,2);exit(0); This aint perl toto that will read from the socket and exit at once. No unless or || here dude. Is this a cut and paste error? Removing the exits makes the c work after a fashion, but it will still print odd greetings. Sorry to break this to you but it looks like the C code is broken as well, although it does look like cut and paste problems.
--

Zigster
  • Comment on Re: C Client / Perl Server incompatibility