[Gambas-devel] gb.net.curl questions

Ron ron at ...572...
Mon Dec 7 20:51:11 CET 2009


Kadaitcha Man schreef:
> 2009/12/8 Ron <ron at ...572...>:
>
>   
>> An another thing, if I create 2 HTTPClients with the same name right
>> after each other and use them Async only the last one triggers it's
>> _Finisched event.
>> The first one is never triggered.
>>
>> Is this normal?
>> So you cannot use 2 with same name right after each other?
>>
>> I believe Benoit told something like that a long time ago... but can't
>> find the e-mail anymore.
>>     
>
> Since you have to use a name for the object if you want it to use it
> with events, it stands to reason that the first object's events get
> clobbered if you subsequently use the same name for another object.
>
>
>   
Yeah that's what I thought at first too, but I think that's not the 
reason, it's more because the way HttpClient is implemented/not in 
background/has a problem.

The following code also shares the same object name and events, but this 
works as expected.

PRIVATE hPing AS Process

PUBLIC SUB MAIN()

    AiboPing(25, "www.google.com")
    AiboPing(26, "192.168.1.61")

END

PRIVATE SUB AiboPing(iId AS Integer, sAddress AS String)

  hPing = EXEC ["ping", "-c1", sAddress] FOR READ AS "PingProcess"
  hPing.Tag = iId

END

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' get id and return value, 0 means ok, anything else is not reached or 
couldn't resolve
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PUBLIC SUB PingProcess_Kill()

  PRINT LAST.Tag
  PRINT LAST.Value

END

This prints
25
0
26
1

Or whichever is first finished, i'm using this now instead, 1 and 0 are 
the return values of ping.
With supplying a .Tag you can keep the responses apart.

Regards,
Ron_2nd.





More information about the Devel mailing list