comp.lang.ada
 help / color / mirror / Atom feed
* Socket buffer filling up
@ 1999-11-18  0:00 Josh Highley
  1999-11-18  0:00 ` Josh Highley
  0 siblings, 1 reply; 6+ messages in thread
From: Josh Highley @ 1999-11-18  0:00 UTC (permalink / raw)


  I'm using Jerry van Dijk's AdaSockets package.  My program performs a 
loop in which two different connections are opened, then closed.  There is 
then a programmed delay of several minutes before the loop is repeated.  My 
problem is that after running for several hours, the socket buffer fills up 
and I get errors when trying to connect, and my web browser can't reach any 
websites.  When I terminate my program, my browser then works fine.

Here's the main points of my code:

WITH Sockets;
USE  Sockets;
-- other withs and uses

PROCEDURE my_sockets IS 

   Connection1 : Socket_Fd;
   Connection2 : Socket_Fd;
   Http_Port   : CONSTANT Positive  := 80;  
   Web_Server1 : CONSTANT String    := "www.server-one.com";
   Web_Server2 : CONSTANT String    := "www.server-two.com";  

BEGIN  -- main program
      Connection1 := Socket (Af_Inet, Sock_Stream);
      Put_Line("Connecting. . .");
      Connect (Connection1, Web_Server1, Http_Port);
    	-- put stuff on socket
      -- get stuff from socket
      Shutdown(Connection1);

    	-- parse the data received

      Connection2 := Socket (Af_Inet, Sock_Stream);
      Connect(Connection2, Web_Server2, Http_Port);

      -- put stuff on socket
      -- get stuff from socket until certain information is found, then...
      Put_Line("Closing Connection.");
      Shutdown(Connection2);
      DELAY Seconds_Wait;  -- I've been delaying 3 minutes
   END LOOP;

END my_sockets;


Looking through the sockets package, I noticed "Bind" and "Setsockopt" 
which has a SO_REUSEADDR option.  I've looked at numerous sources on the 
web, trying to find the exact purpose and use of these but couldn't find 
any answers.

Now that I'm looking at my abbreviated code, I realize that I'm not getting 
all of the data sent to me on Connection2.  This is on purpose since I only 
need a little piece of information (the number of new messages in my email 
account)  I then close the connection without getting the rest of the data.  
I've been assuming that I get the data as the server sends it, but I guess 
the data is stored in the buffer and I 'get' the data from the buffer, 
which is why the buffer is filling up.  Is this correct; did I just answer 
my own question?  I think I got confused on what was going in the buffer.  
Anyway, I'm still interested in getting more info on the other functions in 
Sockets, like Bind and Setsockopt, if anyone knows some sources.

Thanks,

Josh Highley
joshhighley@hotmail.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-11-19  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-18  0:00 Socket buffer filling up Josh Highley
1999-11-18  0:00 ` Josh Highley
1999-11-18  0:00   ` Chad R. Meiners
1999-11-19  0:00     ` Laurent Guerby
1999-11-19  0:00       ` tmoran
1999-11-18  0:00   ` David C. Hoos, Sr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox