Multithread Winsock

N

N.Naeem

Hi all
I am a newbie to VB.NET hence I would like some help or pointers as to a way of developing the following:

A server which listens on a particular port for incoming client connection.
Upon receiving a connection the server starts to process data for that client and sends it back. In terms of data it will be a connection to Oracle, but for the purpose of this post it can be anything I.e. send 1000 numbers back etc.

Now

I would like multiple connections and multiple processes to begin for eg
CLIENT 1 connects the server starts of the data preparation for CLIENT 1
CLIENT 2 Connects the server starts of the data preparation for CLIENT 2
While the data is being prepared for CLIENT 2 CLIENT 1 data is ready and is being sent to CLIENT 1.
CLIENT 3 connects and data preparation starts for CLIENT 3 etc etc

I would like this things to happen simultaneously and not parallel.

hope it is clear

I would appreciate any help

TIA
N
 
T

Tom Shelton

This is a multi-part message in MIME format.

------=_NextPart_000_0016_01C3AEB8.81687D30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all
I am a newbie to VB.NET hence I would like some help or pointers as to a =
way of developing the following:

A server which listens on a particular port for incoming client =
connection.
Upon receiving a connection the server starts to process data for that =
client and sends it back. In terms of data it will be a connection to =
Oracle, but for the purpose of this post it can be anything I.e. send =
1000 numbers back etc.

Now=20

I would like multiple connections and multiple processes to begin for eg
CLIENT 1 connects the server starts of the data preparation for CLIENT 1
CLIENT 2 Connects the server starts of the data preparation for CLIENT =
2
While the data is being prepared for CLIENT 2 CLIENT 1 data is ready and =
is being sent to CLIENT 1.
CLIENT 3 connects and data preparation starts for CLIENT 3 etc etc

I would like this things to happen simultaneously and not parallel.

hope it is clear

I would appreciate any help=20

TIA
N =20


------=_NextPart_000_0016_01C3AEB8.81687D30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT size=3D2>Hi all</FONT></DIV>
<DIV><FONT size=3D2>I am a newbie to VB.NET hence I would like some help =
or=20
pointers as to a way of developing the following:</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>A server which listens on a particular port for =
incoming=20
client connection.</FONT></DIV>
<DIV><FONT size=3D2>Upon receiving a connection the server starts to =
process data=20
for that client and sends it back.&nbsp; In terms of data&nbsp;it will =
be a=20
connection to Oracle, but for the purpose of&nbsp;this post it can be =
anything=20
I.e. send 1000 numbers back etc.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Now </FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I would like multiple connections and multiple =
processes to=20
begin for eg</FONT></DIV>
<DIV><FONT size=3D2>CLIENT 1 connects the server starts&nbsp;of the data =

preparation for CLIENT 1</FONT></DIV>
<DIV><FONT size=3D2>CLIENT 2 Connects the server =
starts&nbsp;&nbsp;&nbsp;of the=20
data preparation for CLIENT 2</FONT></DIV>
<DIV><FONT size=3D2>While&nbsp;the data is being prepared for CLIENT 2 =
CLIENT 1=20
data is ready and is being sent to CLIENT 1.</FONT></DIV>
<DIV><FONT size=3D2>CLIENT 3 connects and data preparation starts for =
CLIENT 3 etc=20
etc</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I would like this things to happen simultaneously =
and not=20
parallel.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>hope it is clear</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I would appreciate any help&nbsp;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>TIA<BR>N&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT size=3D2><BR></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0016_01C3AEB8.81687D30--

Probably the best place to start would be here:

http://msdn.microsoft.com/library/d...e/html/cpconusingnon-blockingclientsocket.asp

Especially pay attention to the topics on Asynchronous clients and
servers (under "Listening with Sockets"). Using Asychrounous Sockets is
probably the most efficient way to do what you want to do - especially
on NT based systems. Also, it removes a lot of the burden of thread
management (though, you still have to worry about syncronization, etc).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top