Results 1 to 2 of 2
I am making a not too complicated web server that responds to any request with the same data, I canno't seem to keep the connection going between the server/client.
The ...
- 05-28-2008 #1Just Joined!
- Join Date
- May 2008
- Posts
- 1
c sockets web server
I am making a not too complicated web server that responds to any request with the same data, I canno't seem to keep the connection going between the server/client.
The client sits there waiting for the server to respond even though it already sent the data. The only time it will stop waiting is when the socket is closed, I cant figure out why the client wont accept the data before the connection is closed, i am using socket( AF_INET, SOCK_STREAM, IPPROTO_TCP )
Anyone have any suggestions?
- 05-28-2008 #2
This will involve a little work on your part, but:
Does "not too complicated" mean "as simple as a server could possibly be that always returns the same data"?
If not, you might want to write a simple-as-can-be server, one that returns constant data, waits five seconds, and then closes the socket. See whether your client gets the data right away or only after five seconds.
And make that data be something that's displayable ASCII text, like:
Then run netcat as your client, so your own client code is out of the picture.Code:char the_data[]="abc\n";
If netcat gets the data right away, then in your original server you probably have a bug which is not directly related to network programming, and you can fix it on your own.
If netcat does not get the data right away, you probably have a network programming issue. In that case, can you post the complete source code for your simple-as-can-be server? By "complete", I mean something that someone can copy and paste and compile; this would include all #include stuff and everything else.
But it won't be that much code, because it's as simple as can be. Then we can take a look at it.--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote