# Help! I have no idea how to solve this! Server Client - IP - Timestamp

**URL:** <https://www.ruby-forum.com/t/help-i-have-no-idea-how-to-solve-this-server-client-ip-timestamp/239600>\
**Category:** Ruby\
**Created:** [March 6, 2014, 10:52am UTC](https://www.ruby-forum.com/t/help-i-have-no-idea-how-to-solve-this-server-client-ip-timestamp/239600 "2014-03-06T10:52:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [March 6, 2014, 10:52am UTC](https://www.ruby-forum.com/t/help-i-have-no-idea-how-to-solve-this-server-client-ip-timestamp/239600/1 "2014-03-06T10:52:39Z")

</div>

Hey Together!  
Got a huge problem. I’m studying abroad in Denmark at the moment and i  
have no clue of Ruby. In Germany I had a little Java, but not more then  
system.out.println. Now I got a question which I have to solve. The  
teacher doesn’t mind, that I have now knowledge about it and wants me to  
not pass the semester, if i don’t solve it.

This is the question:

[quote]Create a client-server program where the client connects to the  
server and the server records in the database the ip and timestamp of  
the incoming connection  
Test it with a server in a different ip from localhost (for example, The  
teachers computer)  
[/quote]

Could anyone help me? I have really no idea how to do. It could be in  
pseudo code also!

Thank you in advance so much,  
yours TotalNoob

---

<div class="post-metadata">

**Author:** ![philipp07](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@philipp07](https://www.ruby-forum.com/u/philipp07)\
**Post date:** [March 6, 2014, 2:47pm UTC](https://www.ruby-forum.com/t/help-i-have-no-idea-how-to-solve-this-server-client-ip-timestamp/239600/2 "2014-03-06T14:47:14Z")

</div>

Philipp Schreyer wrote in post #1139008:

> Create a client-server program

Make 2 scripts : one TCP server, one TCP client

> where the client connects to the  
> server

A simple connect/close socket is done by a tcp ping :

[http://www.java2s.com/Code/Ruby/Network/UsenetpingtoconnecttoaspecificportusingTCPorUDP.htm](http://www.java2s.com/Code/Ruby/Network/UsenetpingtoconnecttoaspecificportusingTCPorUDP.htm)

Or a tcp client:

[http://www.java2s.com/Code/Ruby/Network/OpenasockettohostandportReadlinesfromthesocket.htm](http://www.java2s.com/Code/Ruby/Network/OpenasockettohostandportReadlinesfromthesocket.htm)

> and the server records in the database the ip and timestamp of  
> the incoming connection

a Tcp server:  
[http://www.java2s.com/Code/Ruby/Network/BuildingaSimpleTCPServer.htm](http://www.java2s.com/Code/Ruby/Network/BuildingaSimpleTCPServer.htm)

Or use GServer :  
[http://www.java2s.com/Code/Ruby/Network/GServer.htm](http://www.java2s.com/Code/Ruby/Network/GServer.htm)

> insert a record in database :

[http://www.java2s.com/Code/Ruby/ActiveRecord/Addrecordtodatabasewithsavemethod.htm](http://www.java2s.com/Code/Ruby/ActiveRecord/Addrecordtodatabasewithsavemethod.htm)

[http://www.tutorialspoint.com/ruby/ruby\_database\_access.htm](http://www.tutorialspoint.com/ruby/ruby_database_access.htm)
