On 28 Feb 2008, at 22:00, Alex Tweedly wrote:

Dave wrote:

All I want to do is to know if a Client successfully connected to a Server, surely this is what the openSocket command is for.

Not quite. The 'open socket' command does try to create the connection, but it will not (immediately) tell you whether or not it is successful in this attempt. From the Rev docs, " The handler continues executing while the connection is being established. If you use the write to socket command while the connection is opening, the data is buffered and is sent to the host as soon as the connection is made."

i.e. you will not get an indication of success or failure immediately.

Yes, I realize that the whole thing is asynchronous, when I say "call" I meant arrange to have a message sent at some future time. It's just easier to say "call".


Surely the:

  open socket mySocketAddress with message "ClientSocketOpen"

Statement should call "ClientSocketOpen" if the Server accepted the connection or call "socketError" or "socketTimeout" if there was an error? e.g. the Server closed the socket?
Be wary of that simple word "call". the "open socket" statement will not "call" ClientSocketOpen even in the successful case - instead it will result in a message being sent SOME TIME LATER to that handler. And in the failure case, it will cause a message to either socketError or socketTimeOut again, SOME TIME LATER.

Yes, the code I posted should handle that.

Using the code we've discussed on the server, what you will get on the client is a socketClosed message. The server will accept the connection, which should result in a successful "ClientSocketOpen' and then very quickly close it causing a subsequent 'socketClosed' message.

Before I didn't have a "socketClosed" handler and I thought that this might be the missing part of the jigsaw, so I added one, and it does get called but not till a long time after and sometimes not at all. The "socketError" handler, resends the connect request after a delay of 2 seconds (send in time). The "socketClosed" message only seems to get sent after a few retries whereas it should get sent instead of the first "socketError", or at least during the 2 second wait before the connect is called again. Also the error returned is "Error 54 reading socket", when the command that failed was a write, why is this?

Is there a list of the errors returned by the socket commands?

Thanks a Lot
All the Best
Dave

Here is a dump from the Server and Client logs:

---------------------------------------------------
SERVER LOG
--------------------------------------------------
ServerStart - Accept: 6000
192.168.1.111

ServerContactedByClient: 192.168.1.105:50642
ServerContactedByClient, Bad Client: 192.168.1.105:50642 - Closes Socket

ServerContactedByClient: 192.168.1.105:50643
ServerContactedByClient, Bad Client: 192.168.1.105:50643 - Closes Socket

ServerContactedByClient: 192.168.1.105:50644
ServerContactedByClient, Bad Client: 192.168.1.105:50644 - Closes Socket

ServerContactedByClient: 192.168.1.105:50645
ServerContactedByClient, Bad Client: 192.168.1.105:50645 - Closes Socket

ServerContactedByClient: 192.168.1.105:50646
ServerContactedByClient, Bad Client: 192.168.1.105:50646 - Closes Socket

ServerContactedByClient: 192.168.1.105:50647
ServerContactedByClient, Bad Client: 192.168.1.105:50647 - Closes Socket


---------------------------------------------------
CLIENT LOG
--------------------------------------------------

StartOneClient - Connect: 192.168.1.87:6000|looktowindward
ClientSocketOpen, Open Socket: 192.168.1.87:6000|looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketOpen, Write Command: 192.168.1.87:6000|looktowindward 00000027$SYS,Connect,looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketConnectionDataSent, Data Written: 192.168.1.87:6000| looktowindward
ClientSocketConnectionDataSent, openSockets:


socketError: 192.168.1.87:6000|looktowindward Error 54 reading socket
socketError - openSockets:


StartOneClient - Connect: 192.168.1.87:6000|looktowindward
ClientSocketOpen, Open Socket: 192.168.1.87:6000|looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketOpen, Write Command: 192.168.1.87:6000|looktowindward 00000027$SYS,Connect,looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketConnectionDataSent, Data Written: 192.168.1.87:6000| looktowindward
ClientSocketConnectionDataSent, openSockets:


socketError: 192.168.1.87:6000|looktowindward Error 54 reading socket
socketError - openSockets:


StartOneClient - Connect: 192.168.1.87:6000|looktowindward
ClientSocketOpen, Open Socket: 192.168.1.87:6000|looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketOpen, Write Command: 192.168.1.87:6000|looktowindward 00000027$SYS,Connect,looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketConnectionDataSent, Data Written: 192.168.1.87:6000| looktowindward
ClientSocketConnectionDataSent, openSockets:


socketError: 192.168.1.87:6000|looktowindward Error 54 reading socket
socketError - openSockets:


StartOneClient - Connect: 192.168.1.87:6000|looktowindward
ClientSocketOpen, Open Socket: 192.168.1.87:6000|looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketOpen, Write Command: 192.168.1.87:6000|looktowindward 00000027$SYS,Connect,looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketConnectionDataSent, Data Written: 192.168.1.87:6000| looktowindward
ClientSocketConnectionDataSent, openSockets:


socketError: 192.168.1.87:6000|looktowindward Error 54 reading socket
socketError - openSockets:


StartOneClient - Connect: 192.168.1.87:6000|looktowindward
ClientSocketOpen, Open Socket: 192.168.1.87:6000|looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketOpen, Write Command: 192.168.1.87:6000|looktowindward 00000027$SYS,Connect,looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketConnectionDataSent, Data Written: 192.168.1.87:6000| looktowindward
ClientSocketConnectionDataSent, openSockets:


socketError: 192.168.1.87:6000|looktowindward Error 54 reading socket
socketError - openSockets:


StartOneClient - Connect: 192.168.1.87:6000|looktowindward
ClientSocketOpen, Open Socket: 192.168.1.87:6000|looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketOpen, Write Command: 192.168.1.87:6000|looktowindward 00000027$SYS,Connect,looktowindward
ClientSocketOpen, openSockets:
192.168.1.87:6000|looktowindward

ClientSocketConnectionDataSent, Data Written: 192.168.1.87:6000| looktowindward
ClientSocketConnectionDataSent, openSockets:


socketClosed: 192.168.1.87:6000|looktowindward ********* AT LAST a socketClosed message ********







_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to