|
Home > Archive > Unix Programming > February 2006 > poll blocks indefinitely
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
poll blocks indefinitely
|
|
| j0mbolar 2006-02-22, 2:48 am |
| I'm using the tcp echo server in (the book, pg. 172)
unix network programming which uses poll.
When I run the server and connect to port
9987, and enter data, I get no response.
Upon ltracing the program, I get the following:
socket(2, 1, 0) = 3
bind(3, 0xbfffe020, 16, 0, 0) = 0
getenv("LISTENQ") = NULL
listen(3, 1024, 16, 0, 0x4213030c) = 0
poll(0xbfffe040, 1, -1, 0, 0x4213030c
And that is all. I get no indication of an error. What might
be the issue? The program has been unmodified. I have
used the source straight from the tarball on the book's site.
Any help appreciated.
--
j0mbolar
| |
| Rainer Temme 2006-02-22, 2:48 am |
| j0mbolar wrote:
> I'm using the tcp echo server in (the book, pg. 172)
> unix network programming which uses poll.
> When I run the server and connect to port
> 9987, and enter data, I get no response.
> Upon ltracing the program, I get the following:
> socket(2, 1, 0) = 3
> bind(3, 0xbfffe020, 16, 0, 0) = 0
> getenv("LISTENQ") = NULL
> listen(3, 1024, 16, 0, 0x4213030c) = 0
> poll(0xbfffe040, 1, -1, 0, 0x4213030c
>
> And that is all. I get no indication of an error. What might
> be the issue? The program has been unmodified. I have
> used the source straight from the tarball on the book's site.
Hi j0mbolar,
the trace clearly shows, that your program soes NOT
connect(). It does the usual serverside sequence of
socket(), bind(), listen(), poll(), ... accept().
So either, your trace is showing us the wrong side,
or your client-program (of which we don't see a trace)
is connecting to a different port than the server is
listening to.
Show us the source of the server (especially the things
around bind()), and show us the source of your client
especially around connect(). (Or in the case you use
netcat as client, show us the commandline).
Rainer
|
|
|
|
|