[REBOL] Problem: Talking from Rebol to Rebol via socket
From: robert:muench:robertmuench at: 22-Feb-2009 8:55
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA384
Hi, to track down my problem with the communication between my DLL and Rebol via sockets
I tried to create a Rebol only example. Looks like it has the same problem. Here is my
code (much simpler than the DLL code):
=== Server
rebol []
c-port: 12345
listen: open join tcp://: c-port
waitports: [listen]
print "Listening:"
forever [
; wait until something happens
connection: wait waitports
if same? connection listen [
print [tab "Connected"]
print [tab "Read message from c-side"]
c-client: first connection
wait c-client
print copy c-client
print [tab "Send answer to c-side"]
insert connection "r-side"
print [tab "Closing socket"]
close connection
]
]
=== Client
rebol []
connection: open tcp://localhost:12345
insert connection "r-side-client"
while [data: copy connection] [prin data]
print
close connection
halt
=== Program outputs
- --- Server
Listening:
Connected
Read message from c-side
** Access Error: Network timeout
** Where: forever
** Near: print copy c-client
print [tab "Send answer to c-side"]
>>
- --- Client
** Access Error: Network timeout
** Where: include-script
** Near: data: copy connection
>>
=== Idea & Problem
I want to first send a short message from client to server and than receive an answer
from the server side. I think I'm somehow missing either
- - an "end" marker for the messages or
- - a way to tell that the message is "complete" or
- - a way to specify how long the message will be
I'm sure the fix is quite simple but... I don't get it :-). Any feedback is welcome.
Robert
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.9.1 (Build 287)
Charset: iso-8859-15
wsBVAwUBSaEFDnSQa/BbHGLwAQlSsAf/Uya52MvcoV7+I6X/n79ToKBb8CtMGUOv
jwSO11P4+cYrKAY+3rjJtQgSUlrz4newJCzZOsysojQlO4LowUSw4sXgmeR4C8VV
Dr74N/WFf0Bo40B+80tLpJTkNaTccm8Okf+USVFUIFBkpqJUWTlLf3pN5GAjgIWj
vBwJqNkC6NFhVGBr95lCdjRZjhKj3LWVcQPTQvPIooZUPDt2sIiFRf6OApVYnsQr
GcUhLZoRbadw3ss49r9kY1fIcyJ6iUU0SZ9/9Fmtoaezxk4kqMNgDPxzBufhdLd9
2gLBV6coxhrGjKIfBkKyCl2jgk4iQxspEYQ6X6/wsSBjAJT7eMjO9g==
=kX/q
-----END PGP SIGNATURE-----