Sascha Ernst
2006-Jul-05 15:11 UTC
[Eventmachine-talk] host and port information of remote connection
hello, is it possible to get the host and port information of a Connection instance? btw: how is eventmachine separating the messages between server and client? if it''s done by a terminator like \r\n, is it possible to change it, i.e. to \0? i need that for a connection to a flash client. regards, sascha
Francis Cianfrocca
2006-Jul-05 15:37 UTC
[Eventmachine-talk] host and port information of remote
The peer information (host and port) are now available but you have to get the latest gem, which is not in rubyforge unfortunately. I attached it to this email. Look for the peername method. EM doesn''t send any "separators" in the datastream. That''s entirely controlled by the data you send. On 7/5/06, Sascha Ernst <mail at big-ernesto.de> wrote:> > hello, > > is it possible to get the host and port information of a Connection > instance? > > btw: how is eventmachine separating the messages between server and > client? if it''s done by a terminator like \r\n, is it possible to > change it, i.e. to \0? i need that for a connection to a flash client. > > > regards, sascha > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20060705/785a8f25/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: eventmachine-0.5.4.gem Type: application/octet-stream Size: 48640 bytes Desc: not available Url : http://rubyforge.org/pipermail/eventmachine-talk/attachments/20060705/785a8f25/attachment-0001.obj
Rafael ''Dido'' Sevilla
2006-Jul-05 15:40 UTC
[Eventmachine-talk] host and port information of remote
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Sascha Ernst wrote:> is it possible to get the host and port information of a Connection > instance? >Apparently this will be in version 0.5.4 Francis added a method called ''get_peername'' that does this.> btw: how is eventmachine separating the messages between server and > client? if it''s done by a terminator like \r\n, is it possible to > change it, i.e. to \0? i need that for a connection to a flash client.It doesn''t separate messages between server and client. It does almost no processing of data received from the network. From the rdoc: You must not make any assumptions about the size of the incoming data packets, or about their alignment on any particular intra-message or PDU boundaries (such as line breaks). receive_data can and will send you arbitrary chunks of data, with the only guarantee being that the data is presented to your code in the order it was collected from the network. Don?t even assume that the chunks of data will correspond to network packets, as EventMachine can and will coalesce several incoming packets into one, to improve performance. The implication for your code is that you generally will need to implement some kind of a state machine in your redefined implementation of receive_data. See here [1] for an example of how this probably should be done, especially the receive_data method in the StyxClient module. (NB, this is my Ruby implementation of the 9P2000/Styx client and later this''ll be a server implementation too). [1] http://rubyforge.org/cgi-bin/viewvc.cgi/rstyx/lib/rstyx/client.rb?revision=1.21&root=rstyx - -- We are here for no purpose, unless we can invent one. http://stormwyrm.blogspot.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3-ecc0.1.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQEVAwUBRKw/v4IzXJ0NX9pgAQjY0wf/e8toce6vNPAUaJjaj6GQb6Kx/5f0H+/+ 4G2QKEZ6D8mF98ZSKMem3+WB4mGUCjIDe3ERVRjZ503DnD2fy5sXpqH0HoB6v55v METqnuSOOP2yMhYuTXC5fTvFvc2evOe9UaAkuctDBrqGDmrzbH28hswkYAuECafX 8K6yUIUTQIm3TZ0wSYrkQOJiw/U6jCn4eNdmJh2VArY0DNBxTZZLRXQaBsIpxLpq gmdKoMBbAw37o+qwijD1s6dqahgnFLusWq4559FIgI12h+NauBTcp3alkWZcH1R1 gVHdAzulXw0cEtk6bJSOIsatwP8p9wAfHd36x1q5F1qduZMYlNcOKg==dtrd -----END PGP SIGNATURE-----