Skip to content

Instantly share code, notes, and snippets.

@progre
Created March 17, 2015 12:37
Show Gist options
  • Save progre/adebe3fab379c2f5db97 to your computer and use it in GitHub Desktop.
Save progre/adebe3fab379c2f5db97 to your computer and use it in GitHub Desktop.
TCPを流れるPCPの仕組み

ヘッダーについて

  • 2種類ある
    • チャンネルに対してリレー要求する場合はHTTP
    • それ以外は'pcp\n'Atom
  • どっちかを送ったら以降はAtomでやりとり

ハンドシェイクの仕方

  1. -> どっちかのヘッダーを送る?
  2. -> heloに自分が開放しているポートの情報を詰めて送信
  3. 待ち受けてるポートにheloが届く <-
  4. -> heloが届いたほうからolehを返す
  5. 最初にhelo送ったほうにolehが届く <-

ほっとくとどっちも繋がりっぱなしになる。どっち使うんだこれ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment