ruby入門を初めて5日ほどたったので、socketを使った簡単な通信プログラムを組んでみました。 ただまだ経験が浅いのでバグなど、至らないところがあると思いますが気にしないでください。 プログラム概要 今回組んだプログラムはsocketを用いた通信用のプログラムで応用すればリアルタイムチャットのようなものができます。 機能自体はすごくシンプルに、最低限の機能しか搭載していないので、ファイルは二つです。 サーバー側の「connectTCPserver.rb」とクライアント側の「Client.rb」この二つで最低限の機能を構築しました。 簡単に説明すると、まずサーバー側では20000番ポートをデフォルトで開放し、クライアント側からの接続を待ちます。 このとき、サーバー側では複数のクライアントからの接続を想定して、スレッドを実装しました。 クライアント側では、ユーザーネームとメッセージを入力さ