× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




This simply isn't true.   You can accept more than one connection without
closing the socket in between.  I do it every day.

The pseudocode should look something like this:

     1) call socket() to get a new descriptor
     2) Call bind() to bind to a port
     3) call listen() to tell the system you want to accept connections
     4) call accept() to get a new connection from a client
     5) do something with the client
     6) close the client's descriptor (the one returned by accept())
     7) go back to step 4.


On Mon, 23 Jul 2001, Chris Bipes wrote:

> In your RPG you are only allowing one Socked Descriptor.  You must close the
> SD between accepts.  If you program already has one connection, it will
> refuse the second.  If you accept one connection and not close it properly,
> you will have a lingering SD that you can not reuse.  I found it best to
> delete the SD after closing then creating a new one to use.  It also looks
> like you change SD upon accepting the connection, can the client do that?  I
> don't know the C stuff to be sure?
> 
> Christopher K. Bipes  mailto:ChrisB@Cross-Check.com
> Operation & Network Mgr       mailto:Chris_Bipes@Yahoo.com
> CrossCheck, Inc.      http://www.cross-check.com
> 6119 State Farm Drive Phone: 707 586-0551 x 1102
> Rohnert Park CA  94928        Fax: 707 586-1884
> 
> 
> 
> -----Original Message-----
> From: srichter [mailto:srichter@mail.autocoder.com]
> Sent: Monday, July 23, 2001 5:02 PM
> To: midrange-l@midrange.com
> Subject: 
> 
> 
> 
> Hello all,
> 
> I am attempting to socket from a win95 pc to an as400. Both systems are on
> the same local ethernet lan. Both behind the firewall.
> When I run connect( ) on the pc, a "WSAECONNREFUSED" ( the attempt to
> connect was forcefully rejected ) error code is returned.
> 
> My "Listen" pgm is running on the as400.  It was able to rcv data on a
> loopback test, so I am reasonably sure it is coded correctly.
> ** Create the socket.                                                
>  C                   Eval      SD = Socket (AF_INET: SOCK_STREAM: 0 )
> ** Bind - set local address for the socket.
>  C                   Eval      SocketAddr = *ALLX'00'
>  C                   Eval      SinFamily  = AF_INET
>  C                   Eval      SinPort    = 3005
>  C                   Eval      SinAddr    = INADDR_ANY
>  C                   Eval      rc = Bind (SD: %ADDR(SocketAddr)
>  C                                          : %SIZE(SocketAddr))
> ** Listen - Invite incoming connections.
>  C                   Eval      rc = Listen (SD: 1)<<<<<<<<< only 1 allowed
>  ** Accept - Wait for connection request and Make connection.
>  **   Accept incoming connection request from the client.
>  **   A new socket (SD2) is created for the client.
>  c                   Eval      SD2 = Accept( SD:
>  c                                           %Addr(AccpAddr):
>  c                                           %Addr(AccpAddrLgth) )
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---
> 

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.