1
votes

I am encapsulating a socket communication in an activex exe.

This socket object is created from client application and will provide event notification to client.

When ConnectionRequest event raised,the connection is accepted and the client will be notified through CONNECTED (defined in socket object) event. Everything is working upto this point but ConnectionRequest is again being raised WITH SAME RequestId after the previous connection is accepted through Accept method.

When i am trying to close the socket and reaceept the request,a run time error is generated saying "Run-time Error 10038 ,the Descriptor Is Not A Socket" !

Have anybody faced this problem?please suggest some workaround.

Thanks in advance.

PS:I am using TCP Protocol.

1

1 Answers

0
votes

I'm pretty sure the requestID value is a socket descriptor for the socket in listening state, so it makes sense that it doesn't vary when you have just one listener (which is most common).

These are process-relative, so you can't pass them between processes meaningfully. To accomplish this you would probably have to call the WSADuplicateSocket() function. I have never tried this, so you might try experimenting - but I believe when the ConnectionRequest handler exits without accepting the request the Winsock control sends a refusal.