[Jprogramming] How to sync verb execution with async socket communication?

bill lam bbill.lam at gmail.com
Fri Dec 21 18:39:54 HKT 2007


I might misread your question, but I believe that you can do it by polling until 
all expected data arrived before executing the next statement.

Yuvaraj Athur Raghuvir wrote:
> Hello,
> 
> a) I have a socket_handler associated with a async socket
> b) I have a test verb that performs a series of communication calls - sends
> data, receives data, and decides on the next step based on data returned.
> c) The problem I face is that the execution of the next statement in the
> verb occurs before the data in the socket is read.
> 
> Q: How to synchronize verb execution with socket communication when I use
> async mode on socket?
> 
> Regards,
> Yuva
> 
> 
> 
> 
> On Dec 21, 2007 7:42 AM, Roger Hui <rhui000 at shaw.ca> wrote:
> 
>> For example:
>>
>> perm2=: 3 : 0
>>  z=. i.1 0
>>  for. i.y do. z=. ,/ (0,.1+z) {"2 1 \:"1 = i. 1+{:$z end.
>> )
>>   t=: 5!:5 <'perm2'
>>   t
>> 3 : 0
>>  z=. i.1 0
>>  for. i.y do. z=. ,/ (0,.1+z) {"2 1 \:"1 = i. 1+{:$z end.
>> )
>>   0!:0 'perm3=:',t
>>   perm3
>> 3 : 0
>>  z=. i.1 0
>>  for. i.y do. z=. ,/ (0,.1+z) {"2 1 \:"1 = i. 1+{:$z end.
>> )
>>
>>
>>
>> ----- Original Message -----
>> From: Yuvaraj Athur Raghuvir <yuvaraj.a.r at gmail.com>
>> Date: Thursday, December 20, 2007 17:53
>> Subject: [Jprogramming] Recovering a multi-line verb from a string
>> To: Programming forum <programming at jsoftware.com>
>>
>>> Hello,
>>>
>>> I can use (5!:5) to get a string representation of a verb. If
>>> the verb is
>>> multiline, my attempts to use do (".) to recover the verb fails
>>> with a
>>> syntax error
>>>
>>> How to do it right?
>>>
>>> Regards,
>>> Yuva
>>>
>>> p.s: I am sending the verb as a string via a socket connection.
>>> This way I
>>> want to pass the verbs from the client to the server and then
>>> invoke it
>>> remotely.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


-- 
regards,
bill


More information about the Programming mailing list