# TCP Server

**URL:** <https://www.ruby-forum.com/t/tcp-server/154466>\
**Category:** Ruby\
**Created:** [November 30, 2008, 3:06am UTC](https://www.ruby-forum.com/t/tcp-server/154466 "2008-11-30T03:06:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [November 30, 2008, 3:06am UTC](https://www.ruby-forum.com/t/tcp-server/154466/1 "2008-11-30T03:06:03Z")

</div>

Hi, i’m going to code a game server, i’m new in ruby an would  
like to  
hear some advice about it. I mean, good practices in server programming  
and what i have to take into account like security issues.

Thanks, and excuse my english.

---

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [November 30, 2008, 12:16pm UTC](https://www.ruby-forum.com/t/tcp-server/154466/2 "2008-11-30T12:16:41Z")

</div>

On 30 Nov 2008, at 02:00, Sergio Aristizábal wrote:

> Hi, i’m going to code a game server, i’m new in ruby an would  
> like to  
> hear some advice about it. I mean, good practices in server  
> programming  
> and what i have to take into account like security issues.
> 
> Thanks, and excuse my english.

Hi Sergio,

Welcome to the colourful world of Ruby 🙂

I’ve a couple of presentations at [http://slides.games-with-brains.net/](http://slides.games-with-brains.net/)  
that feature Ruby network code with both TCP and UDP that you may find  
helpful. There’s also some simple crypto stuff in there if you want to  
look into securing traffic on the wire, but that’s a huge subject and  
you’ll definitely want to do further research.

More generally to write a secure server you want to make sure you  
limit access to your application’s database in a clear and consistent  
manner, and ensure that client identity is always clearly established.  
There are also some excellent fuzzing libraries that are worth  
exploring.

Depending on how busy you think your game server will be I’d also  
recommend looking into EventMachine, an event-driven Ruby network  
library that makes it very easy to write scalable network servers.

Ellie

## Eleanor McHugh Games With Brains [http://slides.games-with-brains.net](http://slides.games-with-brains.net)

raise ArgumentError unless @reality.responds\_to? :reason

---

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [December 1, 2008, 11:24pm UTC](https://www.ruby-forum.com/t/tcp-server/154466/3 "2008-12-01T23:24:48Z")

</div>

On 30 Nov 2008, at 21:22, Michal S. wrote:

> 2008/11/30 Eleanor McHugh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > * * *
> > 
> > raise ArgumentError unless @reality.responds\_to? :reason
> 
> ArgumentError (ArgumentError)

🙂

Ellie

Being and Doing are merely useful abstractions for the time-dependent  
asymmetry of phase space.

---

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [November 30, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/tcp-server/154466/4 "2008-11-30T22:28:57Z")

</div>

2008/11/30 Eleanor McHugh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> * * *
> 
> raise ArgumentError unless @reality.responds\_to? :reason

ArgumentError (ArgumentError)

---

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [December 2, 2008, 10:16pm UTC](https://www.ruby-forum.com/t/tcp-server/154466/5 "2008-12-02T22:16:02Z")

</div>

or maybe its REALITY ?

2008/12/2 Jeff M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [December 2, 2008, 10:09pm UTC](https://www.ruby-forum.com/t/tcp-server/154466/6 "2008-12-02T22:09:30Z")

</div>

Eleanor McHugh wrote:

> On 30 Nov 2008, at 21:22, Michal S. wrote:
> 
> > 2008/11/30 Eleanor McHugh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> > 
> > > * * *
> > > 
> > > raise ArgumentError unless @reality.responds\_to? :reason
> > 
> > ArgumentError (ArgumentError)
> 
> 🙂
> 
> Ellie
> 
> Being and Doing are merely useful abstractions for the time-dependent  
> asymmetry of phase space.

By which you mean $reality ?

djief

---

<div class="post-metadata">

**Author:** ![bakkhoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d6d6ee/32.png) [@bakkhoz](https://www.ruby-forum.com/u/bakkhoz)\
**Post date:** [December 3, 2008, 12:24am UTC](https://www.ruby-forum.com/t/tcp-server/154466/7 "2008-12-03T00:24:54Z")

</div>

On 2 Dec 2008, at 21:09, Louis-Philippe wrote:

> > > > ArgumentError (ArgumentError)  
> > > > By which you mean $reality ?  
> > > > As I reserve the right to reject your reality and substitute my own  
> > > > it’s clearly an instance variable 😉

Ellie

## Eleanor McHugh Games With Brains [http://slides.games-with-brains.net](http://slides.games-with-brains.net)

raise ArgumentError unless @reality.responds\_to? :reason
