Hi,
By design UDP sockets doesn't have a "connect" event or something like
that (no SYN/ACK) (you can send a packet to hell without knowing if it
was successfully sent).
That why there is a little bit more changes to do :)
Anthony
Le 04/01/10 18:29, eth0 a écrit :
> Hi Anthony, I've added UDP support manually (at least attempted) just
> by changing the number of params on a few commands, the main code
> change was:
>
> if(strcmp(proto, "tcp") == 0) {
> sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
> } else if(strcmp(proto, "udp") == 0) {
> sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
> }
>
> The socket gets created successfully (returns 9, descriptor) and the
> protocol is chosen correctly, the connect() command seems to work
> correctly to, returning 0. A netstat shows that the connection has
> been established:
>
> udp 0 0 ares.infiniti-e.com:44765
> 95.211.15.217:27015 ESTABLISHED
>
> But the socket events don't seem to fire, heres my SSJS code:
>
> [code-start]
> var Source = new Class({
> initialize: function(){
> var socket = new Ape.sockClient(27015,
> '95.211.15.217', 'udp');
> Ape.log('connecting..');
>
> socket.onConnect = function(){
> Ape.log('connected');
> }
>
> socket.onDisconnect = function(){
> Ape.log('disconnected');
> }
>
> socket.onRead = function(data){
> Ape.log('data: ' + data);
> }
>
> socket.write('\xFF\xFF\xFF\xFF\x54');
> socket.close();
> }
> });
>
> Ape.log('Loading Source...');
> new Source();
> [code-end]
>
> Obviously "connecting.." gets printed, but no "connected",
> "disconnected", "data: xx", etc. Can you think of anything to point me
> in the right direction?
>
>
> On Jan 4, 11:16 am, Anthony Catel<[email protected]> wrote:
>
>> Hi,
>>
>> Indeed, UDP sockets are not suported yet. I'll may be add them on a
>> future release.
>>
>> Anthony
>>
>> Le 04/01/10 00:14, eth0 a �crit :
>>
>>
>>
>>
>>> Hi all, just a quick question; I'm trying to use a socket via UDP but
>>> it seems to be failing and no connection is made - are UDP sockets
>>> supported?
>>>
>>
>>> I took a quick dive into the source and noticed you use the standard
>>> socket() which of course supports UDP. The protocol parameter is set
>>> to 0 which, in my understanding, automatically selects the protocol to
>>> use although I'm not to sure as the socket type is SOCK_STREAM not
>>> SOCK_DGRAM.
>>>
>>
>>> Am I doing something wrong or are they just not supported?
>>>
>>
>>> Regards, Paul.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "APE Project" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/ape-project?hl=en
>>> ---
>>> APE Project (Ajax Push Engine)
>>> Official website :http://www.ape-project.org/
>>> Git Hub :http://github.com/APE-Project/
>>>
>
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/