[REBOL] Problem: Talking from C level to Rebol via socket
From: robert::muench::robertmuench::de at: 21-Feb-2009 16:08
Hi, I really don't know what goes wrong in my code, so here it is for all
you network gurus. Hopefully one can help:
=== Setup
I have DLL that triggers an event to Rebol via a localhost socket and
expects an answer from Rebol.
=== Problem
As long as I obmit the part where the Rebol side wants to send back
something an answer to the DLL everything works.
As soon as I add the code the DLL that should receive an anwer from Rebol
the Rebol side gets an timeout error. Nothing is received on the DLL side.
=== Rebol side
- I create a DLL-LSOCKET listen socket
- WAIT DLL-LSOCKET on it
- get the real DLL-SOCKET: FIRST DLL-LSOCKET
- get the trigger by
WAIT DLL-SOCKET
trigger: to-block copy DLL-SOCKET
return trigger
- process the trigger and create an ANSWER
- send back the ANSWER
insert DLL-SOCKET
- CLOSE DLL-SOCKET
- return to my main-loop waiting for the next connection.
=== DLL Side
As soon as the DLL side want to send a trigger, it does:
- setup all necessary socket infos
- CONNECT() to the rebol process
- SEND() the trigger string to the rebol process
- Uses SELECT() to wait for some data from the rebol process
- RECV() data from the rebol process
- CLOSE() the socket
I expect the problem to be on the DLL side in that after the SEND() I need
to get the DLL side into a waiting mode until an answer form the Rebol
process is send back. The Rebol side sends an answer immediatly, so I know
no there is no timeout problem.
Maybe the problem is on the Rebol side. Do I have to INSERT into
DLL-LSOCKET or DLL-SOCKET? I think it's DLL-SOCKET. Do I have to "switch"
between read/write mode? I don't think so but...
Hopefully anyone can help.
--
Robert M. Münch
Mobile: +49 (177) 245 2802
http://www.robertmuench.de