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

In reply to Re: C Client / Perl Server incompatibility by zigster
in thread C Client / Perl Server incompatibility by Magius_AR

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.