# Client server

**URL:** <https://www.ruby-forum.com/t/client-server/187681>\
**Category:** Ruby\
**Created:** [April 27, 2010, 7:02pm UTC](https://www.ruby-forum.com/t/client-server/187681 "2010-04-27T19:02:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lykos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5e925/32.png) [@lykos](https://www.ruby-forum.com/u/lykos)\
**Post date:** [April 27, 2010, 7:02pm UTC](https://www.ruby-forum.com/t/client-server/187681/1 "2010-04-27T19:02:17Z")

</div>

Hi,  
in our family, we often play a strongly modified version of Monopoly.  
But since this sometimes needs a lot of calculations, I’m programming  
this for Computers with brother.

We intended to use a server which handles the game logic and clients  
which are basically just user interfaces.  
I never did anything with networks in Ruby. Of course, I could just do  
the whole program with Rails, then I wouldn’t have to worry about  
anything, but I just wanted to do it “on my own” for once, since it is  
very useful to learn network stuff.  
But now I don’t know anything about how this is done properly. Of  
course, there are sockets, I assume there is something like remote  
procedure call or so and maybe there is something fancier and more Ruby  
like around.

And by the way, it’s the first time for me to combine the client server  
model with MVC. I just thought I’d put all the game logic, that would be  
the model, into the server program. The view of course has to be the  
user’s GUI. But I don’t really know yet how to handle the controller. I  
could just let the client only consist of the GUI and put all the  
controller logic into the server. But somehow this doesn’t seem very  
flexible since I want to put other views and maybe even AI players there  
instead of the GUI. So I’m slightly confused how to do that properly  
right now.

Sorry for posting so many questions at once, but I just was sick today  
and programmed all day, so I just got some questions…

---

<div class="post-metadata">

**Author:** ![lykos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5e925/32.png) [@lykos](https://www.ruby-forum.com/u/lykos)\
**Post date:** [April 27, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/client-server/187681/2 "2010-04-27T19:24:24Z")

</div>

> But now I don’t know anything about how this is done properly. Of  
> course, there are sockets, I assume there is something like remote  
> procedure call or so and maybe there is something fancier and more Ruby  
> like around.

there is drb:  
[http://segment7.net/projects/ruby/drb/introduction.html](http://segment7.net/projects/ruby/drb/introduction.html)  
client server  
require ‘socket’;  
TCPServer.new ‘0.0.0.0’, 8000; # server  
TCPSocket.new ‘127.0.0.1’, 8000; # client

and EventMachine, basically (probably a few more options).  
GL!  
-rp
