LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Socket programming (https://www.linuxquestions.org/questions/programming-9/socket-programming-288306/)

maldini1010 02-09-2005 06:18 PM

Socket programming
 
Hi folks,

I have a question regarding socket programming. I am able to acces an HTTP/1.0 server and I am trying to send multiple requests to it. The problem is the server seems to accept and answer only the first request but not the successive ones. This is the scenario:

connect(); //succesful (done in the constructor of a class)

write() //succesful (done in fn1 of a class)
read() //succesful (done in fn1 of a class)

write()// succesful (done in fn2 of a class)
read() = -1 => not succesful (done in fn2 of a class)

NOTE: The function calls are internal to the class so there is no problem of killing the connection to the socket by killing the object!!

Could you give me some hints on how to do this please?

Thanks

maldini

itsme86 02-09-2005 06:20 PM

The HTTP server kills the connection after supplying the requested document. You'll have to reconnect for each request.

maldini1010 02-09-2005 06:44 PM

your a star!!!!!! It works


Thanks a lot It really helped me!!

maldini

Mara 02-11-2005 05:27 PM

But if you connect to HTTP 1.1 server it should accept a number of request in the same connection :)

maldini1010 02-11-2005 11:16 PM

You might be right, however the server which I'm communicating with is a HTTP/1.0 and I have tried recreating the socket and is is successful ............so I simply made a function Connect() and call each time i need to send in a request.

Thanks
maldini


All times are GMT -5. The time now is 03:24 PM.