Click here to Skip to main content
15,906,708 members
Home / Discussions / C#
   

C#

 
GeneralRe: Making an exception class Pin
Andy Smith7-Apr-03 6:30
Andy Smith7-Apr-03 6:30 
GeneralRe: Making an exception class Pin
S O S7-Apr-03 17:29
S O S7-Apr-03 17:29 
GeneralI have a problem with streaming XML Pin
zoltix7-Apr-03 3:01
zoltix7-Apr-03 3:01 
GeneralRe: I have a problem with streaming XML Pin
James T. Johnson7-Apr-03 7:15
James T. Johnson7-Apr-03 7:15 
GeneralRe: I have a problem with streaming XML Pin
zoltix7-Apr-03 9:12
zoltix7-Apr-03 9:12 
GeneralData Authorization Pin
Adam Turner7-Apr-03 0:38
Adam Turner7-Apr-03 0:38 
GeneralRe: Data Authorization Pin
Rocky Moore7-Apr-03 4:53
Rocky Moore7-Apr-03 4:53 
Generalabout to choose .NET vs Borland Pin
Konrad Rotuski7-Apr-03 0:32
Konrad Rotuski7-Apr-03 0:32 
GeneralRe: about to choose .NET vs Borland Pin
Rocky Moore7-Apr-03 5:18
Rocky Moore7-Apr-03 5:18 
GeneralRe: about to choose .NET vs Borland Pin
Konrad Rotuski7-Apr-03 6:03
Konrad Rotuski7-Apr-03 6:03 
GeneralRe: about to choose .NET vs Borland Pin
Rocky Moore8-Apr-03 5:26
Rocky Moore8-Apr-03 5:26 
Generalvirtual parameter Pin
Nick Seng6-Apr-03 22:25
Nick Seng6-Apr-03 22:25 
GeneralRe: virtual parameter Pin
S O S7-Apr-03 5:00
S O S7-Apr-03 5:00 
GeneralRe: virtual parameter Pin
Nick Seng7-Apr-03 16:34
Nick Seng7-Apr-03 16:34 
GeneralRe: virtual parameter Pin
S O S7-Apr-03 17:29
S O S7-Apr-03 17:29 
GeneralRe: virtual parameter Pin
Rocky Moore7-Apr-03 5:24
Rocky Moore7-Apr-03 5:24 
QuestionHow to capture Click events from outside the form? Pin
DavidDunning6-Apr-03 21:49
DavidDunning6-Apr-03 21:49 
AnswerRe: How to capture Click events from outside the form? Pin
codepunk7-Apr-03 11:36
codepunk7-Apr-03 11:36 
GeneralCustom Control at Design Time Pin
Itanium6-Apr-03 21:46
Itanium6-Apr-03 21:46 
GeneralA lot of Sockets Pin
nahumtakum6-Apr-03 12:24
nahumtakum6-Apr-03 12:24 
GeneralRe: A lot of Sockets Pin
neroknights7-Apr-03 4:54
neroknights7-Apr-03 4:54 
GeneralRe: A lot of Sockets Pin
nahumtakum7-Apr-03 12:07
nahumtakum7-Apr-03 12:07 
My server socket already uses Accept method.

The thing is that I eant to avoid this situation:

IPEndPoint a_EndPoint = new IPEndPoint(ipAddress, a_port);
IPEndPoint b_EndPoint = new IPEndPoint(ipAddress, b_port);
...

// Create a TCP/IP socket.
Socket a_listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
Socket b_listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );

// Bind the socket to the local endpoint and listen for incoming connections.
try
{
a_listener.Bind(a_EndPoint);
a_listener.Listen(num_of_clients);
// The maximum length of the queue of pending connections
b_listener.Bind(b_EndPoint);
b_listener.Listen(num_of_clients);
// The maximum length of the queue of pending connections
...

while (true)
{
// Set the event to nonsignaled state.
all_done.Reset();

// Start an asynchronous socket to listen for connections.
Console.WriteLine("Waiting for a connection...");

a_listener.BeginAccept( new AsyncCallback(accept_callback_a), a_listener );
b_listener.BeginAccept( new AsyncCallback(accept_callback_b), b_listener );
...

// Wait until a connection is made before continuing.
all_done.WaitOne();


You see, I have to create a new object for socket, and to create each one its own function and its own delegat...

How can I avoid this ?


Thanks.
GeneralRe: A lot of Sockets Pin
neroknights8-Apr-03 3:58
neroknights8-Apr-03 3:58 
GeneralRe: A lot of Sockets Pin
nahumtakum8-Apr-03 4:12
nahumtakum8-Apr-03 4:12 
GeneralRe: A lot of Sockets Pin
neroknights8-Apr-03 8:27
neroknights8-Apr-03 8:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.