I got two sockets in my program. One should recieve data , and one should send the data that the other one recieves. What is the best way to implement that? Thread for each socket? and if so , how can I transfer the information?
I want to put this into a dll , so using windows messages is not a good solution for me.
Anyone has a better idea to suggest?

thanks in advance,
bar.
Posted on 2004-10-27 14:59:09 by realcr
Hi there
so you can also recv and write on one socket. Use the following tut for that one:http://www.codeproject.com/internet/networkevents.asp
Concerning the window-msgs you are right, that winsock1 implementation is f*cked. Better create a new thread that handles the whole network thing while the main process is not affected. When you want to use that dll in other languages (c++ or vb) you should make use of Callback-Functions.
Dominik
Posted on 2004-10-27 17:05:48 by Dom
Tnx for your post dominik.
However , I have to recieve information from one source, and send it to another location.
That what I was trying to implement.

realcr.
Posted on 2004-10-28 13:24:38 by realcr
The question is, when do you need to send data to some other location? Is it randomly or as a reaction on the inputs from socket 1? If so you can just run everything in one thread, create both sockets, connect them, listen on the one and as a reaction on recv-call you send on the second socket.
If both sockets should work stand-a-lone, just use two threads. Watch out when data / notifications is to be transfered between the threads.
Dominik
Posted on 2004-10-28 13:29:15 by Dom
I was told in masm32 forum that I could use select to do that without threads , However I also seen the function WSAAsyncSelect. What is the difference between those functions? Is select only for blocking sockets?


realcr.
Posted on 2004-10-29 08:51:33 by realcr