[En-Nut-Discussion] TCP Stream question

Harald Kipp harald.kipp at egnite.de
Sun Oct 26 19:03:53 CET 2003


Looks good.

Well, in that case I assume that it hangs in an old
connection.

You should exit the loop in case of an error (like
dropped connection).

if (fgets(buff, sizeof(buff), stream) == 0) {
    break;
}

I'd also recommend to install ethereal, it's very
helpful.

Harald


At 12:50 26.10.2003 -0500, you wrote:
>Harald,
>
>  static u_char buff[1024];
>
>Most of the code I'm using is from inteq.c.
>
>Ken
>
>
>At 12:06 PM 10/26/2003, you wrote:
>>Ken,
>>
>>How's buff declared?
>>
>>Harald
>>
>>>for (;;) {
>>>
>>>   fgets(buff, sizeof(buff), stream);
>>>
>>>   if ((cp = strchr(buff, '\r')) != 0) *cp = 0;
>>>   if ((cp = strchr(buff, '\n')) != 0) *cp = 0;
>>>   if (buff[0] == 0) continue;
>>>
>>>    puts(buff);
>>>}
>>>
>>>But this doesn't print anything to the serial port.
>>
>>
>>_______________________________________________
>>En-Nut-Discussion mailing list
>>En-Nut-Discussion at egnite.de
>>http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list