Tim Uckun
2008-Jan-03 19:24 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
> Tim, are you able to use an earlier EM version that is precompiled for Win32 > (I think 0.8.0 is available)? At least that way you can get started with > your application. > > I think that as a general rule, the deployment model for Windows has to be > with precompiled gems, because the build-chain problem is such a bear on > Windows (requiring VC6; requiring a compiler in the first place; etc, etc). >Yes the earlier version worked .8.1. I''ll stick with this till I hear otherwise from you guys. Can I piggy back a quick question? I want to write a program that sends packets back and forth between two servers. One server sends a UDP message to the other, the other replies back. At the same time the reverse is true. Both machines are reacting to and initiating packets to each other. Should I write a separate server and a sender or is it possible to combine the two in the same program.
Francis Cianfrocca
2008-Jan-04 05:34 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
On Jan 3, 2008 10:24 PM, Tim Uckun <timuckun at gmail.com> wrote:> Yes the earlier version worked .8.1. I''ll stick with this till I hear > otherwise from you guys. >Like all EM releases, 8.1 is perfectly stable and production-ready. You can check the ChangeLog file in the distro to see what features have been added since then.> > Can I piggy back a quick question? > > I want to write a program that sends packets back and forth between > two servers. One server sends a UDP message to the other, the other > replies back. At the same time the reverse is true. Both machines are > reacting to and initiating packets to each other. > > Should I write a separate server and a sender or is it possible to > combine the two in the same program. >Use the same program. In case you''re not already a UDP expert, read the rdocs for EM#send_datagram, for important information that may save you some trouble. Specifically, if you want to use the often-seen firewall-friendly model in which a UDP "server" receives packets on a well-known port, and sends replies to the same port on the client machine (as NTP does, for example), that model works perfectly well in EM. Just bind both sides to the same port and use #send_data inside your #receive_data handler. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080104/7c2b2175/attachment-0001.html
Roger Pack
2008-Jan-04 10:37 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
> Use the same program. In case you''re not already a UDP expert, read the > rdocs for EM#send_datagram, for important information that may save you some > trouble. > > Specifically, if you want to use the often-seen firewall-friendly model in > which a UDP "server" receives packets on a well-known port, and sends > replies to the same port on the client machine (as NTP does, for example), > that model works perfectly well in EM. Just bind both sides to the same port > and use #send_data inside your #receive_data handler.Question: so would that be two ports total, in that case? one send->recv, one send->recv (different ports)? -- -Roger Pack For God hath not given us the spirit of fear; but of power, and of love, and of a sound mind" -- 2 Timothy 1:7
Michael S. Fischer
2008-Jan-04 10:56 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
On Jan 4, 2008 10:37 AM, Roger Pack <rogerpack2005 at gmail.com> wrote:> > Use the same program. In case you''re not already a UDP expert, read the > > rdocs for EM#send_datagram, for important information that may save you some > > trouble. > > > > Specifically, if you want to use the often-seen firewall-friendly model in > > which a UDP "server" receives packets on a well-known port, and sends > > replies to the same port on the client machine (as NTP does, for example), > > that model works perfectly well in EM. Just bind both sides to the same port > > and use #send_data inside your #receive_data handler. > > Question: so would that be two ports total, in that case? one > send->recv, one send->recv (different ports)?The two listening sockets must be bound either to different ports or different interfaces. Most UNIX-like OSes will allow you to create > 1 loopback interface or IP alias (in the case of a non-loopback). Best regards, --Michael
Francis Cianfrocca
2008-Jan-04 18:09 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
On Jan 4, 2008 1:37 PM, Roger Pack <rogerpack2005 at gmail.com> wrote:> > Use the same program. In case you''re not already a UDP expert, read the > > rdocs for EM#send_datagram, for important information that may save you > some > > trouble. > > > > Specifically, if you want to use the often-seen firewall-friendly model > in > > which a UDP "server" receives packets on a well-known port, and sends > > replies to the same port on the client machine (as NTP does, for > example), > > that model works perfectly well in EM. Just bind both sides to the same > port > > and use #send_data inside your #receive_data handler. > > Question: so would that be two ports total, in that case? one > send->recv, one send->recv (different ports)? > >As I read the original use case, the idea was to have this ping-ponging happening between two DIFFERENT COMPUTERS. Maybe I misread it. If I''m correct, then you can use the identical software, with identical ports, on both computers. Because of the UDP works, it''s entirely possible to send data from a UDP port that is listening (acting as a server), and have the remote peer see the well-known port as the source address. EM wraps all this stuff up quite nicely. Read the rdoc for EM#send_datagram for more info. In my experience, people have a lot more trouble grokking UDP than TCP, even though it''s a much simpler protocol :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080104/135a0bf5/attachment.html
Tim Uckun
2008-Jan-05 00:37 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
> As I read the original use case, the idea was to have this ping-ponging > happening between two DIFFERENT COMPUTERS. Maybe I misread it. >Yes that''s my intent but I might use the same machine for testing.> Read the rdoc for EM#send_datagram for more info.I don''t intend to write a line of code till I read all the rdocs and even the comments in the source (which are very useful by the way, thank you!)> > In my experience, people have a lot more trouble grokking UDP than TCP, even > though it''s a much simpler protocol :-) >I know a little. I would not call myself an expert by any means though. I am just writing a tool to diagnose some network problems.
Francis Cianfrocca
2008-Jan-05 03:11 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
On Jan 5, 2008 3:37 AM, Tim Uckun <timuckun at gmail.com> wrote:> > As I read the original use case, the idea was to have this ping-ponging > > happening between two DIFFERENT COMPUTERS. Maybe I misread it. > > > > Yes that''s my intent but I might use the same machine for testing. > > >In that case, just parameterize it with two different ports (port A and port B, since both peers combine the role of client and server) and you can run two instances of the same code (with different parameters) on the same machine. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080105/48997e5f/attachment.html
Tim Uckun
2008-Jan-05 20:25 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
> > In that case, just parameterize it with two different ports (port A and port > B, since both peers combine the role of client and server) and you can run > two instances of the same code (with different parameters) on the same > machine.would it work to put them on different IP addresses? For example put one at 127.0.0.100 and the other at 127.0.0.200?
Francis Cianfrocca
2008-Jan-05 21:00 UTC
[Eventmachine-talk] Ping Pong server was( Problems trying to
On Jan 5, 2008 11:25 PM, Tim Uckun <timuckun at gmail.com> wrote:> > > > In that case, just parameterize it with two different ports (port A and > port > > B, since both peers combine the role of client and server) and you can > run > > two instances of the same code (with different parameters) on the same > > machine. > > > would it work to put them on different IP addresses? For example put > one at 127.0.0.100 and the other at 127.0.0.200? > >I''d try it with different ports first. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080106/40948169/attachment.html