タグ

TCPとsocketに関するmsakamoto-sfのブックマーク (4)

  • ソケットプログラミングのTips

    概要 ソケットプログラミングに関するTipsをメモレベルで記載する。 切断検知と経路切断 TCPコネクションの切断検出 対向がclose()、shuttdown()、プログラム終了等をしたときの切断検出について。 OSをシャットダウンさせた場合も通常はアプリケーションの終了処理が走り、正常な切断が動く。 受信側の切断検出は、recv()がlength==0で返ってきたとき、または、errno==ECONNRESETとなる。(ECONNRESETはRSTによって切断された場合) 送信側の切断検出は、切断された後2回目のsend()がエラーとなる。 ※相手がclose()→こちらがsend()→相手にパケットが飛ぶが待ち受けプログラムがいないためRST応答が来る→もう1度send()→エラー ※send()自体はカーネルの送信バッファにデータコピーするだけなので、TCPレベルの応答(送信完了)

    ソケットプログラミングのTips
  • RSocket | RSocket

    Why RSocket?RSocket provides a protocol for Reactive Streams semantics between client-server, and server-server communication. Motivations What is RSocket?RSocket is a binary protocol for use on byte stream transports such as TCP, WebSockets, and Aeron. Protocol Spec How do I use RSocket?RSocket is intended to be consumed via one of the various implementation libraries which implement the RSocket

    RSocket | RSocket
  • When TCP sockets refuse to die — Idea of the day

    This article was first published on Cloudflare blog: When TCP sockets refuse to die Accompanying scripts While working on our Spectrum server, we noticed something weird: the TCP sockets which we thought should have been closed were lingering around. We realized we don't really understand when TCP sockets are supposed to time out! In our code, we wanted to make sure we don't hold connections to de

  • PythonによるTCP/IPソケットプログラミング | Ohmsha

    書は、Pythonによる実装を前提として、ソケットプログラミングに必要な知識をわかりやすく解説する入門書です。TCP/IPやソケットの原理を説明したのち、Pythonでソケットを実装する基礎的方法を示していきます。さらに、Python固有の機能を用いたプログラミング例(モジュールを利用したサーバ実装など)を紹介します。 ダウンロードできるサンプルプログラムが多数掲載されているので、実際に試しながら読み進めて、知識と技術を身につけてください。 【書の基環境】 書は、Windows・Annaconda・Python3の使用を基としています。 しかし、使用しているモジュールはごく標準的であるため、それ以外の環境でも、書で使用しているプログラムは問題なく動作すると考えられます。 【書内で使用するPythonモジュール】 socket sys datetime threading os

    PythonによるTCP/IPソケットプログラミング | Ohmsha
  • 1