| Re: Winsock -
06-04-2007, 08:52 AM
"N.Naeem" <EMAIL REMOVED> wrote in message
news:3fc60d70$0$27478$EMAIL REMOVED t.net...
> Hello all
>
> i need a solution to the following problem
>
> I have an application which listens to a port for incoming connections
from
> a client via a Winsock. let's call this Winsock1
>
> Upon a connection of a client i would like the application to call an
> ActiveX.exe which also has a Winsock Control (Winsock2), and i would like
to
> transfer the Winsock1 information to Winsock2, hence allowing the client
> now to talk
> directly to the Winsock2 on the ActiveX control,
> and hence freeing up the Winsock1 to start listening again.
> And if another client connects then i would like the same to happen again.
> So basically i would find a number of the activex.exe being called.
> This would have to be Asynchronus i.e. both clients being processed
> simultaneuously
>
> TIA
>
This is how I would attempt it
Create a ClientConnectionManager
Set up a Socket Array
Listen on Socket 0 for a connection at all times
When a request is received create (load) next free socket
Accept the client request to the newly created socket,
Winsock1(TheNextIndex).Accept ID
then immediately (in the same event)
Create a New AX instance & Call a method that creates a socket &
returns its random Listening port number example.Sub called
CreateSocketConn.
Example call
Winsock1(TheNextIndex).SendData "Use" & AXinstance.CreateSocketConn()
So first time the client successfully connects it will receive a random port
number where it can close the first connection & reconnect to the port the
AX will be listening on.
Other details would need to be incorporated no doubt
e.g. The AX shuts down after a certain time if the connection is not
successful.
and some event error handling bla....bla.......
HTH
Geoff
--
>
>
> |