Forum: Ruby Establish a connection between two computers?

B108916be03f8a27b45bb94ca26648d2?d=identicon&s=25 cynic limbu (cyniclimbu)
on 2014-02-19 14:03
I'd like to know how to establish a connection between me and another
computer via a ruby script.

Also If you happen to know a good place where I can learn networking on
ruby that'd be great.
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2014-02-19 15:46
cynic limbu wrote in post #1137205:

> Also If you happen to know a good place where I can learn networking on
> ruby that'd be great.

tutorials:
 https://www6.software.ibm.com/developerworks/educa...
 https://leejava.wordpress.com/2009/08/24/udp-clien...


book (picaxe) :
  http://ruby-doc.com/docs/ProgrammingRuby/html/tut_io.html
  http://ruby-doc.com/docs/ProgrammingRuby/html/ospace.html
  http://ruby-doc.com/docs/ProgrammingRuby/html/lib_...

snippets :
  http://www.java2s.com/Code/Ruby/Network/CatalogNetwork.htm
  (this is not java only...)

> I'd like to know how to establish a connection between me and another
> computer via a ruby script.

see tcp_server and tcp_client and gserver
    udp_server and udp_client
    Ruby remoting (ie. drb)
in java2s snippets

goog luck... :)
B108916be03f8a27b45bb94ca26648d2?d=identicon&s=25 cynic limbu (cyniclimbu)
on 2014-02-19 15:56
> goog luck... :)

Thank you very much :]
15000f55138ae94b0f362ed7c625461a?d=identicon&s=25 unknown (Guest)
on 2014-02-19 16:20
(Received via mailing list)
Am 19.02.2014 14:03, schrieb cynic limbu:
> I'd like to know how to establish a connection between me and another
> computer via a ruby script.

That's rather vague... What kind of connection?

Regards,
Marcus
B108916be03f8a27b45bb94ca26648d2?d=identicon&s=25 cynic limbu (cyniclimbu)
on 2014-02-20 10:44
unknown wrote in post #1137222:
> Am 19.02.2014 14:03, schrieb cynic limbu:
>> I'd like to know how to establish a connection between me and another
>> computer via a ruby script.
>
> That's rather vague... What kind of connection?
>
> Regards,
> Marcus

unknown wrote in post #1137222:
> Am 19.02.2014 14:03, schrieb cynic limbu:
>> I'd like to know how to establish a connection between me and another
>> computer via a ruby script.
>
> That's rather vague... What kind of connection?
>
> Regards,
> Marcus

Apologies, I'm not good with TCP/IP thing so I was wondering a type of
connection like chatting (3-4 people chat), Or sending files.

Sending data
My computer --> Server --> My another computer

Receiving data
My another computer --> Server --> My computer

I'm thinking that it would be better If it was a direct connection
rather than the server standing in front of computers.
It is possible? Without a server? To send and receive files?

Last question would be
Can I turn my computer itself into a server? Or does it have to be a
website?

Don't worry about my computer not being able to handle the requests,
Just two computers sending/receiving data.
15000f55138ae94b0f362ed7c625461a?d=identicon&s=25 unknown (Guest)
on 2014-02-20 14:57
(Received via mailing list)
Am 20.02.2014 10:44, schrieb cynic limbu:
> Apologies, I'm not good with TCP/IP thing so I was wondering a type of
> connection like chatting (3-4 people chat), Or sending files.
>
> Sending data
> My computer --> Server --> My another computer
>
> Receiving data
> My another computer --> Server --> My computer

If you're not thinking about a webapp and HTTP requests or using
other existing protocols (like ftp, ...) you probably want TCPServer
and TCPSocket.

Learning about threads might be useful, too, when you want to
write a chat server and client.

See the links Regis d'Aubarede provided, and you should easily
find more examples online, even specific tutorials on building
a chat server.

Regards,
Marcus
6e366eb5a71be2bad7f383d42aeb4788?d=identicon&s=25 Justin Collins (Guest)
on 2014-02-20 16:57
(Received via mailing list)
On 02/19/2014 05:03 AM, cynic limbu wrote:
> I'd like to know how to establish a connection between me and another
> computer via a ruby script.
>
> Also If you happen to know a good place where I can learn networking on
> ruby that'd be great.
>

GServer (in Ruby's stdlib) is probably the easiest place to start:
http://rdoc.info/stdlib/gserver/GServer

Here's an example of using it for a chat server:
https://gist.github.com/presidentbeef/767666#file-...

-Justin
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.