c# - getting network streams using tcplistener for mulitple connections -



c# - getting network streams using tcplistener for mulitple connections -

i'm trying have different network stream each client i'm listening (using tcplistener) here's illustration code:

while(listener.pending()) { socket sock = listener.acceptsocket(); networkstream stream = new networkstream(sock); list.add(stream); }

my question is, list consist of different network streams, 1 each client tries create connection? ty

yes, you'll 1 networkstream per socket, , accepted sockets client-specific.

but you're misusing pending function. should utilize asynchronous methods beginacceptsocket or acceptasync. while(listener.pending()) loop exit no client trying connect, prevent getting connections.

c# sockets networking tcplistener networkstream

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -