[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Lloyd Dupont

10/10/2003 4:13:00 PM

I'm doing some stress test for some TcpIP communication.
rougly it's someting like that:

for(i=0; i<1000; i++)
{
Sockect s = new Socket()
s.Connect(endPoint);

NetworkStream ns = new NetworkStream(s);
// .... read / write about 10k random bytes
....
ns.Close();
s.Close();
}

the problem is sometimes (usually at the 994th iteration, but not always) I
have a socket exception on Connect()
(NativeErrorCode: 10048, only one socket could listen at a given
address/port) ???
It's a client socket, and I don't bind it at all !!!


31 Answers

Greg Ewing [MVP]

10/10/2003 7:02:00 PM

0

Lloyd, could you post a working, simple sample which demonstrates what you
are seeing? A simple command line app would be perfect.

--
Greg Ewing [MVP]
http://www.c...



"Lloyd Dupont" <net.galador@ld> wrote in message
news:OJECfl0jDHA.2616@TK2MSFTNGP11.phx.gbl...
> I'm doing some stress test for some TcpIP communication.
> rougly it's someting like that:
>
> for(i=0; i<1000; i++)
> {
> Sockect s = new Socket()
> s.Connect(endPoint);
>
> NetworkStream ns = new NetworkStream(s);
> // .... read / write about 10k random bytes
> ....
> ns.Close();
> s.Close();
> }
>
> the problem is sometimes (usually at the 994th iteration, but not always)
I
> have a socket exception on Connect()
> (NativeErrorCode: 10048, only one socket could listen at a given
> address/port) ???
> It's a client socket, and I don't bind it at all !!!
>
>


zane(_)abderaware.com(ZaneThomas

10/11/2003 11:51:00 PM

0

On Sat, 11 Oct 2003 02:12:59 +1000, "Lloyd Dupont" <net.galador@ld> wrote:

> s.Close();

The socket handles don't go away immediately, and so it sounds as if you're
running out.



--
What the caterpillar calls the end,
the rest of the world calls a butterfly.
~ Lao-tzu

Components For Thinkers
www.abderaware.com
zane @at@ abderaware .dot. com

Ron Alberda [MSFT]

10/21/2003 10:48:00 PM

0

This is a known issue. You are running out of "wildcard" ports. When you do
a connect the socket uses a wildcard port for receiving data. Each
connection goes into a "TIME_WAIT" state to prevent immediate re-use of the
port. This is by design to prevent port hijacking. The port becomes
available again after two minutes. If you do a "netstat -a" when you notice
the socket Exception you'll see lots of connections in the "TIME_WAIT"
state.

The workaround is to do a System.Threading.Thread.Sleep for ~2 minutes when
you get close to 1000 connections.

-Ron

"Lloyd Dupont" <net.galador@ld> wrote in message
news:ulDvoT5jDHA.2244@TK2MSFTNGP12.phx.gbl...
> here you go, the stress client and server.
> compile with:
> csc /nologo /out:client.exe StressTest.cs StressClient.cs
> csc /nologo /out:server.exe StressTest.cs StressServer.cs
>
> and run server & client in 2 different console, although I would advise
you
> to run client with a debugger, to catch the exception.
>
> when I run client multiple time it bug, randomly, about every second
> times....
>
> "Greg Ewing [MVP]" <gewing@_NO_SPAM_citidc.com> a écrit dans le message de
> news:OaUDDE2jDHA.1488@TK2MSFTNGP12.phx.gbl...
> > Lloyd, could you post a working, simple sample which demonstrates what
you
> > are seeing? A simple command line app would be perfect.
> >
> > --
> > Greg Ewing [MVP]
> > http://www.c...
> >
> >
> >
> > "Lloyd Dupont" <net.galador@ld> wrote in message
> > news:OJECfl0jDHA.2616@TK2MSFTNGP11.phx.gbl...
> > > I'm doing some stress test for some TcpIP communication.
> > > rougly it's someting like that:
> > >
> > > for(i=0; i<1000; i++)
> > > {
> > > Sockect s = new Socket()
> > > s.Connect(endPoint);
> > >
> > > NetworkStream ns = new NetworkStream(s);
> > > // .... read / write about 10k random bytes
> > > ....
> > > ns.Close();
> > > s.Close();
> > > }
> > >
> > > the problem is sometimes (usually at the 994th iteration, but not
> always)
> > I
> > > have a socket exception on Connect()
> > > (NativeErrorCode: 10048, only one socket could listen at a given
> > > address/port) ???
> > > It's a client socket, and I don't bind it at all !!!
> > >
> > >
> >
> >
>
>
>


Lloyd Dupont

10/26/2003 7:13:00 AM

0

ho, ok.
thanks for the info.
I had an excellent work around since then, anyway ;-)

"Ron Alberda [MSFT]" <ronalda@online.microsoft.com> a écrit dans le message
de news:efMUxVCmDHA.2964@tk2msftngp13.phx.gbl...
> This is a known issue. You are running out of "wildcard" ports. When you
do
> a connect the socket uses a wildcard port for receiving data. Each
> connection goes into a "TIME_WAIT" state to prevent immediate re-use of
the
> port. This is by design to prevent port hijacking. The port becomes
> available again after two minutes. If you do a "netstat -a" when you
notice
> the socket Exception you'll see lots of connections in the "TIME_WAIT"
> state.
>
> The workaround is to do a System.Threading.Thread.Sleep for ~2 minutes
when
> you get close to 1000 connections.
>
> -Ron
>
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:ulDvoT5jDHA.2244@TK2MSFTNGP12.phx.gbl...
> > here you go, the stress client and server.
> > compile with:
> > csc /nologo /out:client.exe StressTest.cs StressClient.cs
> > csc /nologo /out:server.exe StressTest.cs StressServer.cs
> >
> > and run server & client in 2 different console, although I would advise
> you
> > to run client with a debugger, to catch the exception.
> >
> > when I run client multiple time it bug, randomly, about every second
> > times....
> >
> > "Greg Ewing [MVP]" <gewing@_NO_SPAM_citidc.com> a écrit dans le message
de
> > news:OaUDDE2jDHA.1488@TK2MSFTNGP12.phx.gbl...
> > > Lloyd, could you post a working, simple sample which demonstrates what
> you
> > > are seeing? A simple command line app would be perfect.
> > >
> > > --
> > > Greg Ewing [MVP]
> > > http://www.c...
> > >
> > >
> > >
> > > "Lloyd Dupont" <net.galador@ld> wrote in message
> > > news:OJECfl0jDHA.2616@TK2MSFTNGP11.phx.gbl...
> > > > I'm doing some stress test for some TcpIP communication.
> > > > rougly it's someting like that:
> > > >
> > > > for(i=0; i<1000; i++)
> > > > {
> > > > Sockect s = new Socket()
> > > > s.Connect(endPoint);
> > > >
> > > > NetworkStream ns = new NetworkStream(s);
> > > > // .... read / write about 10k random bytes
> > > > ....
> > > > ns.Close();
> > > > s.Close();
> > > > }
> > > >
> > > > the problem is sometimes (usually at the 994th iteration, but not
> > always)
> > > I
> > > > have a socket exception on Connect()
> > > > (NativeErrorCode: 10048, only one socket could listen at a given
> > > > address/port) ???
> > > > It's a client socket, and I don't bind it at all !!!
> > > >
> > > >
> > >
> > >
> >
> >
> >
>
>


Roy Green

10/30/2003 2:34:00 PM

0

What was your excellent work around?

Roy

"Lloyd Dupont" <net.galador@ld> wrote in message
news:u3cRTC5mDHA.1676@TK2MSFTNGP09.phx.gbl...
> ho, ok.
> thanks for the info.
> I had an excellent work around since then, anyway ;-)
>
>


Lloyd Dupont

11/12/2003 10:41:00 AM

0

sorry for this late answer, I didn't touch my computer lately.

well the workaround is simple, I juste create one socket ;-)
I use a connected mode, I oen a bunch of client to my server and kept them
open and reuse them.

it runs very well and local test were twice as fast.

the coding were much longer though (there is lot of sofistication working
transparently like async read/write, auto-reconnection, message queuing and
home made thread pool ...)

"Roy Green" <roygreen@mindspring.com> a écrit dans le message de
news:u0ivPLvnDHA.3612@TK2MSFTNGP11.phx.gbl...
> What was your excellent work around?
>
> Roy
>
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:u3cRTC5mDHA.1676@TK2MSFTNGP09.phx.gbl...
> > ho, ok.
> > thanks for the info.
> > I had an excellent work around since then, anyway ;-)
> >
> >
>
>


Matt Hungo

3/13/2009 7:19:00 AM

0

On Mar 12, 7:29 pm, merengue <merenguerosals...@gmail.com> wrote:

> Como dice dicho articulo las ventas de casas han mejorado por los
> precios baratos de las mismas y miles ya estan invirtiendo su dinero
> esperando mejores precios en el futuro. Aprovecha y veras como piensas
> en mejores cosas.

Nuestro creador de exiliados chilenos no detiene allí su fantasía.
También dice que "miles ya están invirtiendo su dinero". No importa
que el artículo dice:

"This is the time to pull the trigger," he tells his clients. "If the
market has not reached bottom, it is very close to bottom. Things are
turning around."
Perhaps. That remains to be seen. South Florida's recent sales surge
is more likely due to the sudden willingness of federally-supported
banks to accept half, or even a third, of what a property was once
worth.
These same banks account for nearly two-thirds of the sellers here. In
other words, the market is still deeply diseased, just shedding its
more gangrenous flesh.
Matt

merengue

3/13/2009 11:38:00 AM

0

On Mar 13, 3:19 am, Matt Hungo <eddielawre...@comcast.net> wrote:
> On Mar 12, 7:29 pm, merengue <merenguerosals...@gmail.com> wrote:
>
> > Como dice dicho articulo las ventas de casas han mejorado por los
> > precios baratos de las mismas y miles ya estan invirtiendo su dinero
> > esperando mejores precios en el futuro. Aprovecha y veras como piensas
> > en mejores cosas.
>
> Nuestro creador de exiliados chilenos no detiene allí su fantasía.
> También dice que "miles ya están invirtiendo su dinero". No importa
> que el artículo dice:
>
> "This is the time to pull the trigger," he tells his clients. "If the
> market has not reached bottom, it is very close to bottom. Things are
> turning around.">>>>>

se nota que ni sabes lo que lees. Si la crisis esta muy cerca al fondo
del ciclo y las cosas estan cambiando entonces este es el mejor
momento para invertir ya que el precio de las casas se nivelaran y
disminuiran las opciones para encontrar casas baratas.


> Perhaps. That remains to be seen. South Florida's recent sales surge
> is more likely due to the sudden willingness of federally-supported
> banks to accept half, or even a third, of what a property was once
> worth.>>>>>>>>

con mas razon para inventir y aprovechar que los bancos quieren salir
de las casas que han embargado a precios bajos.

> These same banks account for nearly two-thirds of the sellers here. In
> other words, the market is still deeply diseased, just shedding its
> more gangrenous flesh.>>>>>>>

Cuando el vendedor esta desesperado y quiere salir de su mercancia
implica precios de ventas bajos y eso aprovecha el inversionista.

> Matt

El que demostro que ni siquiera sabes el significado de la palabra
exiliado y que perdio tu tiempo hablando de un tema que no entiede se
embarca en otra faena que tampoco entiende.

Aplasta_Cipayos

3/13/2009 6:00:00 PM

0

On Mar 13, 7:37 am, merengue <merenguerosals...@gmail.com> wrote:
(Palabras Vacuas)

En fin, todavia no entiendes que la idea de artificialmente inflar el
precio de las casas y negarse a regular la industria de la banca y
bienes raices fueron las razones principales de la caida de la
economia de EUA?... Ademas de sinverguenza eres bruto.

Matt Hungo

3/13/2009 11:22:00 PM

0

On Mar 13, 4:37 am, merengue <merenguerosals...@gmail.com> wrote:

> se nota que ni sabes lo que lees. Si la crisis esta muy cerca al fondo
> del ciclo y las cosas estan cambiando entonces este es el mejor
> momento para invertir ya que el precio de las casas se nivelaran y
> disminuiran las opciones para encontrar casas baratas.
>
> > These same banks account for nearly two-thirds of the sellers here. In
> > other words, the market is still deeply diseased, just shedding its
> > more gangrenous flesh.>>>>>>>
>
> Cuando el vendedor esta desesperado y quiere salir de  su mercancia
> implica precios de ventas bajos y eso aprovecha el inversionista.
>
> > Matt
>
> El que  demostro que ni siquiera sabes el significado de la palabra
> exiliado y que perdio tu tiempo hablando de un tema que no entiede se
> embarca en otra faena que tampoco entiende.

Pero claro, Merenguito, claro. Sólo que el artículo dice que es dudoso
que tengas razón porque los vecindarios están tan destruidos que lo
más probable es que los precios sigan cayendo y que, finalmente, los
eventuales compradores se encontrarán que son propietarios de ruinas
muy bonitas que sólo valen como material de demolición.
Y sigue preparando -en tu imaginación- esa lista que nunca existió: la
de los exiliados chilenos en USA durante el gobierno del doctor
Allende.