TCPListener.Accept() not blocking? 
Author Message
 TCPListener.Accept() not blocking?

After looking through MSDN and the gotdotnet dateTimeServer sample, I spun
out a little net app. Well, to my suprise I started getting errors right
away. After about 5 minutes I realized my .Accept function on the listening
class was not blocking! I found a way around it (simply call .Pending to see
if there are any waiting connections, then do the Accept), but I'm curious
as to why this isn't document, and actually described as the opposite.

Ex:
' Accept will block until someone connects
 Dim s As Socket = tcpl.Accept()

Nope, just returns Nothing!

Am I just doing something wrong?

Ben Vanik



Thu, 29 May 2003 06:55:13 GMT  
 TCPListener.Accept() not blocking?
Perhaps it is a bug in the default behavior. I am using code which
explicitly turns blocking on and Accept seems to block just fine. The docs
say blocking is the default, but maybe not - I didn't check that...

--
Rockford Lhotka



Quote:
> After looking through MSDN and the gotdotnet dateTimeServer sample, I spun
> out a little net app. Well, to my suprise I started getting errors right
> away. After about 5 minutes I realized my .Accept function on the
listening
> class was not blocking! I found a way around it (simply call .Pending to
see
> if there are any waiting connections, then do the Accept), but I'm curious
> as to why this isn't document, and actually described as the opposite.

> Ex:
> ' Accept will block until someone connects
>  Dim s As Socket = tcpl.Accept()

> Nope, just returns Nothing!

> Am I just doing something wrong?

> Ben Vanik



Fri, 30 May 2003 14:07:57 GMT  
 TCPListener.Accept() not blocking?
Thanx
Yes, I believe, contrary to the docs, that blocking is NOT on by default

weird.... typical MS :)

Ben Vanik


Quote:
> Perhaps it is a bug in the default behavior. I am using code which
> explicitly turns blocking on and Accept seems to block just fine. The docs
> say blocking is the default, but maybe not - I didn't check that...

> --
> Rockford Lhotka



> > After looking through MSDN and the gotdotnet dateTimeServer sample, I
spun
> > out a little net app. Well, to my suprise I started getting errors right
> > away. After about 5 minutes I realized my .Accept function on the
> listening
> > class was not blocking! I found a way around it (simply call .Pending to
> see
> > if there are any waiting connections, then do the Accept), but I'm
curious
> > as to why this isn't document, and actually described as the opposite.

> > Ex:
> > ' Accept will block until someone connects
> >  Dim s As Socket = tcpl.Accept()

> > Nope, just returns Nothing!

> > Am I just doing something wrong?

> > Ben Vanik



Fri, 30 May 2003 19:48:10 GMT  
 TCPListener.Accept() not blocking?
The default for Sockets is Blocking=False.

--
Jonathan Allen


Quote:
> Thanx
> Yes, I believe, contrary to the docs, that blocking is NOT on by default

> weird.... typical MS :)

> Ben Vanik



> > Perhaps it is a bug in the default behavior. I am using code which
> > explicitly turns blocking on and Accept seems to block just fine. The
docs
> > say blocking is the default, but maybe not - I didn't check that...

> > --
> > Rockford Lhotka



> > > After looking through MSDN and the gotdotnet dateTimeServer sample, I
> spun
> > > out a little net app. Well, to my suprise I started getting errors
right
> > > away. After about 5 minutes I realized my .Accept function on the
> > listening
> > > class was not blocking! I found a way around it (simply call .Pending
to
> > see
> > > if there are any waiting connections, then do the Accept), but I'm
> curious
> > > as to why this isn't document, and actually described as the opposite.

> > > Ex:
> > > ' Accept will block until someone connects
> > >  Dim s As Socket = tcpl.Accept()

> > > Nope, just returns Nothing!

> > > Am I just doing something wrong?

> > > Ben Vanik



Sat, 31 May 2003 01:30:00 GMT  
 TCPListener.Accept() not blocking?
Rocky,

 Have you come across a way to detect if a connected socket has been
abnormally closed/disconnected?  Also, when using the BeginReceive method of
a Socket object, is it normal to have to keep calling the BeginReceive
method repeatedly after receiving data?

Any help would be appreciated.


Quote:
> Perhaps it is a bug in the default behavior. I am using code which
> explicitly turns blocking on and Accept seems to block just fine. The docs
> say blocking is the default, but maybe not - I didn't check that...

> --
> Rockford Lhotka



> > After looking through MSDN and the gotdotnet dateTimeServer sample, I
spun
> > out a little net app. Well, to my suprise I started getting errors right
> > away. After about 5 minutes I realized my .Accept function on the
> listening
> > class was not blocking! I found a way around it (simply call .Pending to
> see
> > if there are any waiting connections, then do the Accept), but I'm
curious
> > as to why this isn't document, and actually described as the opposite.

> > Ex:
> > ' Accept will block until someone connects
> >  Dim s As Socket = tcpl.Accept()

> > Nope, just returns Nothing!

> > Am I just doing something wrong?

> > Ben Vanik



Fri, 06 Jun 2003 23:04:51 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Create Threads on TCPListener.Accept

2. can not Stop tcpListener

3. dbVersion20 does not accept dbText?

4. CreateTableDef Does Not Accept vbAttachedTable as Parameter

5. Number Keypad Values Not accepted as Numieric

6. NDR from Exchange some servers not accept

7. DataGrid not accepting Enter?

8. Public declarations not accepted

9. Program not accepting keystrokes.

10. Text box not accepting keystrokes

11. Winsock array not accepting multiple connections

12. VB4 16 bit LoadPicture not accepting above ascii 127 chars

 

 
Powered by phpBB® Forum Software