45 Matching Annotations
  1. Aug 2023
    1. In computing, the robustness principle is a design guideline for software that states: "be conservative in what you do, be liberal in what you accept from others". It is often reworded as: "be conservative in what you send, be liberal in what you accept". The principle is also known as Postel's law, after Jon Postel, who used the wording in an early specification of TCP.


      Robustness principle: be conservative in what you do, be liberal in what you accept from others.

  2. May 2023
    1. IPFS can open up to 1000 connections by default and suck up all your bandwidth – and that’s just for exchanging keys with other DHT peers.

      imho, the main problem with IPFS is that it does DHT over TCP, which is crazy-inefficient, compared to bittorrent, which does DHT over UDP, which "just works"

      one reason for DHT over TCP is to make this work in a web browser, which does not support UDP. so instead of teaching web browsers to talk UDP, IPFS took the simple route of "lets take bittorrent and run DHT over TCP"

      IPFS is obsolete, many goals of IPFS can be achieved with bittorrent v2

      generally, treating web browsers as the main target platform (and thus inheriting their limitations) is a bad idea, equally stupid as the "lets run everything in javascript/WASM" idea

    1. 🥳

      ```js import { connect } from 'cloudflare:sockets';

      export default { async fetch(req: Request) { const gopherAddr = "gopher.floodgap.com:70"; const url = new URL(req.url);

      try {
        const socket = connect(gopherAddr);
        const writer = socket.writable.getWriter()
        const encoder = new TextEncoder();
        const encoded = encoder.encode(url.pathname + "\r\n");
        await writer.write(encoded);
        return new Response(socket.readable, { headers: { "Content-Type": "text/plain" } });
      } catch (error) {
        return new Response("Socket connection failed: " + error, { status: 500 });

      } }; ts connect(address: SocketAddress | string, options?: SocketOptions): Socket

      declare interface Socket { get readable(): ReadableStream; get writable(): WritableStream; get closed(): Promise<void>; close(): Promise<void>; startTls(): Socket; }

      declare interface SocketOptions { secureTransport?: string; allowHalfOpen: boolean; }

      declare interface SocketAddress { hostname: string; port: number; } ```

    1. ```ts

      /* * Initiates a connection to the selected port. / async function connectToServer(): Promise<void> { hostInput.disabled = true; portInput.disabled = true; connectButton.textContent = 'Connecting...'; connectButton.disabled = true;

      try { socket = new TCPSocket(hostInput.value, parseInt(portInput.value)); connection = await socket.opened; term.writeln('<CONNECTED>'); connectButton.textContent = 'Disconnect'; connectButton.disabled = false; } catch (e) { console.error(e); term.writeln(<ERROR: ${e.message}>); markDisconnected(); return; }

      try { reader = connection?.readable.getReader(); for (;;) { const {value, done} = await reader.read(); if (value) { await new Promise<void>((resolve) => { term.write(value, resolve); }); } if (done) { break; } } reader.releaseLock(); reader = undefined; } catch (e) { console.error(e); term.writeln(<ERROR: ${e.message}>); }

      markDisconnected(); }

      /* * Closes the currently active connection. / async function disconnectFromServer(): Promise<void> { // Canceling |reader| will close the connection and cause the read loop in // connectToServer() to exit when read() returns with done set to true. if (reader) { await reader.cancel(); } } ```

  3. Apr 2023
  4. Mar 2023
  5. Dec 2022
  6. Oct 2022
  7. Jun 2022
  8. Mar 2022
    1. 真实环境,数据库服务器进程和客户端进程可能运行在不同的主机中,它们之间必须通过网络进行通讯。

      MySQL 采用 TCP 作为服务器和客户端之间的网络通信协议。

      在网络环境下,每台计算机都有一个唯一的 IP 地址,如果某个进程需要采用 TCP 协议进行网络通信方面的需求,可以向操作系统申请一个端口号,这是一个整数值,它的取值范围是 0~65535。

      这样在网络中的其他进程就可以通过 IP 地址 + 端口号的方式来与这个进程链接,这样进程之间就可以通过网络进行通信了。



  9. Feb 2022
  10. Sep 2021
    1. This is what I call a leaky abstraction. TCP attempts to provide a complete abstraction of an underlying unreliable network, but sometimes, the network leaks through the abstraction and you feel the things that the abstraction can’t quite protect you from. This is but one example of what I’ve dubbed the Law of Leaky Abstractions:
  11. Jul 2021
  12. datatracker.ietf.org datatracker.ietf.org
    1. Relationship to TCP and HTTP _This section is non-normative._ The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request. By default, the WebSocket Protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over Transport Layer Security (TLS) [RFC2818].
  13. Feb 2021
    1. The alternative was to have multiple scripts or stylesheet links on one page, which would trigger multiple HTTP requests. Multiple requests mean multiple connection handshakes for each link “hey, I want some data”, “okay, I have the data”, “alright I heard that you have the data, give it to me” (SYN, ACK, SYNACK). Even once the connection is created there is a feature of TCP called TCP slow start that will throttle the speed of the data being sent at the beginning of a request to a slower speed than the end of the request. All of this means transferring one large request is faster than transferring the same data split up into several smaller requests.
  14. Nov 2018
  15. Oct 2018
  16. Jul 2017
  17. Jan 2017
  18. Nov 2013
    1. In a Literary Lab project on 18th-century novels, English students study a database of nearly 2,000 early books to tease out when “romances,” “tales” and “histories” first emerged as novels, and what the different terms signified.

      This may be a reference to the Eighteenth Century Collection Online-Text Creation Partnership (ECCO-TCP) project, which transcribed and marked up in XML ~2,200 eighteenth-century books from the Eighteenth Century Collections Online database (ECCO). The ECCO-TCP corpus is in the public domain and available for anyone to use: http://www.textcreationpartnership.org/tcp-ecco/