LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-09-2005, 06:18 PM   #1
maldini1010
Member
 
Registered: Sep 2004
Location: Montreal
Posts: 53

Rep: Reputation: 15
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
 
Old 02-09-2005, 06:20 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 58
The HTTP server kills the connection after supplying the requested document. You'll have to reconnect for each request.
 
Old 02-09-2005, 06:44 PM   #3
maldini1010
Member
 
Registered: Sep 2004
Location: Montreal
Posts: 53

Original Poster
Rep: Reputation: 15
your a star!!!!!! It works


Thanks a lot It really helped me!!

maldini
 
Old 02-11-2005, 05:27 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,537

Rep: Reputation: 149Reputation: 149
But if you connect to HTTP 1.1 server it should accept a number of request in the same connection
 
Old 02-11-2005, 11:16 PM   #5
maldini1010
Member
 
Registered: Sep 2004
Location: Montreal
Posts: 53

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me ... about Socket programming.. rajsun Programming 2 04-24-2005 04:50 PM
socket programming???? harbir Linux - Networking 2 07-05-2004 02:52 AM
want help in socket programming valib4u *BSD 2 09-11-2003 11:17 PM
Socket Programming cxel91a Programming 4 03-19-2003 10:05 AM
socket programming herambshembekar Programming 3 04-13-2002 03:13 PM


All times are GMT -5. The time now is 02:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration