TCPIP server single connection
-
hi im coding c# sockets in Asynchronous mode. my app is running but i need to limit the number clients to one. so if a connection already exists i want the server to refuse any new connection. but using async methods i cant stop it from listening. the server will have to be restarted everytime the unique connection is terminated, so i dont need it to serve next new connection. how could i refuse new connections when async does not support it? thank you very much.
-
hi im coding c# sockets in Asynchronous mode. my app is running but i need to limit the number clients to one. so if a connection already exists i want the server to refuse any new connection. but using async methods i cant stop it from listening. the server will have to be restarted everytime the unique connection is terminated, so i dont need it to serve next new connection. how could i refuse new connections when async does not support it? thank you very much.
Whether you're using synchronous or asynchronous methods you have to explicitly tell the
TcpListener
orSocket
to accept a new connection using one of theBeginAccept
orAccept
methods. If you don't want more than one client connected then don't call those methods more than once.:badger:
-
Whether you're using synchronous or asynchronous methods you have to explicitly tell the
TcpListener
orSocket
to accept a new connection using one of theBeginAccept
orAccept
methods. If you don't want more than one client connected then don't call those methods more than once.:badger:
-
are you sure you still want asynchronous operation if all that is going on is a single connection? seems to me you're paying the bills but not getting the goods. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.