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, , accept
ed 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
Post a Comment