Skip to content

yukikom-biz/simplehttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is yukikoma's HTTP server!

リファレンス

https://docs.oracle.com/javase/jp/8/docs/api/allclasses-noframe.html

socket

socketis one endpoint of a two-way communication link
between two programs running on the network.

ソケットとは、TCP/IP通信を行うために使用されるライブラリ(API)であり、
クライアントサイドでは、接続先のホストIP、ポート番号がセットされる必要がある。
サーバー側は、どのポートでクライアントからのリクエストを待ち受けるのかを保持している必要がある。

そのソケットを通じてクライアントと、サーバーは通信を行う。

サーバー側の動き

  • 初期化
  • 待ち受けポートを指定
  • 待ち受け開始
  • 接続待ち
  • (クライアントからのリクエストがあったら)
  • 受信
  • 送信
  • 切断終了

クライアント側のソケット

  • 初期化
  • 接続
  • 送信
  • (サーバーからのレスポンスを待って)
  • 受信
  • 切断
  • 終了

サーバーステイタス

サーバーさん「このポートで待ってますよー」
→Listen (ソケット作成)

他にも

  • TIME_WAIT
  • CLOSE_WAIT
  • ESTABLISH
    がある。

おまけ

Image from Gyazo

参考文献

<sys/socket.h>

socket(2) - Linux manual page

All About Sockets https://docs.oracle.com/javase/tutorial/networking/sockets/index.html

ソケットの基本的な使用 (ネットワークインタフェース)

【図解】初心者にも分かる TCP/UDP 〜違いや共通点,使い分け,ポート番号,具体例について〜 | SEの道標

References

HTTP-related specification

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published