Login  
Search All Forums
Dart Home | PowerTCP Winsock for ActiveX | Custom Development Reply | PowerTCP Winsock for ActiveX Topics | Forums   
AuthorForum: PowerTCP Winsock for ActiveX
Topic: error code 10057 in tcp_receive event
patcherke

From: antwerp, Belgium
Posts: 8
Member Since: 06/26/03
posted July 22, 2003 8:46 AM

Hi,

I have a program that sends data to a server, and than waits for the answer which is processed further on.

I do the following :

(variable name of the socket component is 'tcp')

if tcp.state = tcpclosed then
  tcp.connect IP-adress, port
end if
...
tcp.send datastring



connection succeeds and sending doesn't generate an error.

between the connect-method and the send-method are
only about 10 statements, to check if the IP-adress and port is provided and to log if neccessary.

a few seconds after the send-method the tcp_receive event triggers.

in this event I do 'tcp.receive data' to store the data into a string.
On this method an error 10057 occurs (socket is not connected)

Now I know that the tcp_receive event is triggered whe the receivebuffersize changes.
I suppose that this means that the connected server responds, and that this also means that the socket is connected. Or am I wrong?

So, if I receive something using the tcp.receive method, than why does this error occurs?



Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted July 22, 2003 9:17 AM

What happens after the call to 'Send'? Is there anything that closes the connection? If so that is the problem. It looks to me like you have a blocking/non-blocking problem. You seem to start out in a synchronous/blocking fashion, then swith to asynchronous non-blocking (as indicated by receiving in the event rather than in the same funtion where you Connected.)

You should stick to blocking mode until you develop an understanding of how asynchronous programming works.

patcherke

From: antwerp, Belgium
Posts: 8
Member Since: 06/26/03
posted July 22, 2003 9:33 AM

normally the connection stays open after the send-method.
I have a procedure which opens the connection and uses the tcp.send-method. After these two statements, the procedure exits.


the disconnection normally is done after the data is received using one or more time(s) the receive-method.
the tcp.close-method is called from within the tcp_receive-event.

so I send data, wait for an answer, and if I get an answer, I store the data and then close the connection.

I don't use the send-event, only the receive-event

This problems occurs especially when the network is unstable, so I guess that indeed the connection is closed before the tcp-receive-method is called.
But what is strange then, is that the receive-event (which calls the receive-method(s)) is triggered in the first place.
(i.e. if a connection is closed, how can the buffersize be changed?)

Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted July 22, 2003 9:44 AM

The only way I will be able to troubleshoot this will be to try to do it myself and see what is happening. If you have support, please send a very simple project that will allow us to see the problem occur to support@dart.com.

If you don't have support, you'll have to get it. Oftentimes things like this require severall hours of work at our end to duplicate and for that you need support. Please contact our sales department if needed.

Reply | PowerTCP Winsock for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX