Phlip said:
I thought WinSock turned 'net input events into windows input events,
meaning you could write an event-driven chat client that needs no threads.
I have to say that I am in the beginning of the networking chapter, so I know few things
so far. Also I do not know what exactly is the Winsock that you are talking about.
Naturally there are probably events for which we can assign member functions of our
classes as handlers, however not using multithreading implies that we are doing only one
task at a time. So for example upon sending a message (even in a matter of milliseconds
time), the client would not be able to receive a message or allow us to type. The same
upon receiving. And I suppose even when we are typing we will not be able to send or
receive (in console it is certain, since the program would wait until we press enter to
pass the input in cin and I suppose the same applies for GUI text boxes, since this is
also a type of input, and the typing itself raises events).
Perhaps you know more on this issue, what I have read so far is that networking "always"
involves multithreading (apart from some unusual cases I suppose).
I also thought you could simulate WinSock by multiplexing socket handle
semaphores with your message queue.
I don't know what exactly you are talking about. The fundamental class of .NET networking
is the Socket class which is considered the most low level part. However you never use
that class directly under usual circumstances, you use higher level classes that use the
Socket class, and their methods manipulate their underlying Socket objects.
So here is how you are making a client and connecting to a server instantly:
TcpClient *client= __gc new TcpClient;
client->Connect(serverAddress, serverPort);
It is nice, isn't it?
