Is there any way to obtain the network address of a connection when using EventMachine as a network server? We''re attempting to develop a peer-to-peer protocol in which the server must instruct one peer of another''s network address, and as far as we can tell the EventMachine API doesn''t expose this information. -- Tony Arcieri ClickCaster, Inc. tony at clickcaster.com (970) 232-4208 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20061016/3b363c61/attachment.html
On 10/16/06, Tony Arcieri <tony at clickcaster.com> wrote:> > Is there any way to obtain the network address of a connection when using > EventMachine as a network server? We''re attempting to develop a > peer-to-peer protocol in which the server must instruct one peer of > another''s network address, and as far as we can tell the EventMachine API > doesn''t expose this information.Look at EventMachine::Connection#get_peername. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20061016/760cb4a8/attachment.html
Speaking of which, getpeername may be more portable than getsockopt() for catching errors on connect completion: http://cr.yp.to/docs/connect.html Connect, write-select, getpeername is how all our code works. On 10/16/06, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> Look at EventMachine::Connection#get_peername.
On 10/16/06, Thomas Ptacek <thomasptacek at gmail.com> wrote:> > Speaking of which, getpeername may be more portable than getsockopt() > for catching errors on connect completion: > > http://cr.yp.to/docs/connect.html > > Connect, write-select, getpeername is how all our code works.There''s a lot of platform-specific code in EM to handle connect errors. It would be great if you could take a look through it and see if there is room for improvement. (Look in version_0/ext/em.cpp, EventMachine::ConnectToServer and several other places.) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20061016/acb5bb9d/attachment.html
Any reason this isn''t in the RDoc? On 10/16/06, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> > On 10/16/06, Tony Arcieri <tony at clickcaster.com> wrote: > > > > Is there any way to obtain the network address of a connection when > > using EventMachine as a network server? We''re attempting to develop a > > peer-to-peer protocol in which the server must instruct one peer of > > another''s network address, and as far as we can tell the EventMachine API > > doesn''t expose this information. > > > > Look at EventMachine::Connection#get_peername. > > > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk > >-- Tony Arcieri ClickCaster, Inc. tony at clickcaster.com (970) 232-4208 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20061016/b800ac96/attachment-0001.html
On 10/16/06, Tony Arcieri <tony at clickcaster.com> wrote:> > Any reason this isn''t in the RDoc? > > On 10/16/06, Francis Cianfrocca <garbagecat10 at gmail.com> wrote: > > > > On 10/16/06, Tony Arcieri < tony at clickcaster.com> wrote: > > > > > > Is there any way to obtain the network address of a connection when > > > using EventMachine as a network server? We''re attempting to develop a > > > peer-to-peer protocol in which the server must instruct one peer of > > > another''s network address, and as far as we can tell the EventMachine API > > > doesn''t expose this information. > > > > > > > > Look at EventMachine::Connection#get_peername. > > > > > > _______________________________________________ > > Eventmachine-talk mailing list > > Eventmachine-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/eventmachine-talk > >Yeah, it was added recently. Sync to the latest source and it will be in the Rdoc. I promise I''ll cut a new release as soon as I can get to it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20061016/96926dfe/attachment.html