diff options
| author | user <user@clank> | 2026-07-17 13:06:38 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-17 13:06:38 +0200 |
| commit | c0e74377af490b93aa452a19652c61cead9c39ff (patch) | |
| tree | 2e27a587637654814d11e1da658a24909ce77a04 /src/hram.asm | |
| parent | net: UDP sockets in the kernel + a DNS resolver (real hostname lookups) (diff) | |
| download | gbos-c0e74377af490b93aa452a19652c61cead9c39ff.tar.gz gbos-c0e74377af490b93aa452a19652c61cead9c39ff.tar.xz gbos-c0e74377af490b93aa452a19652c61cead9c39ff.zip | |
net: TCP sockets in the kernel - a Game Boy fetches HTTP over real TCP
Kernel TCP client on the socket layer: net_connect(SOCK_TCP) runs the 3-way
handshake in-kernel, send()/recv() drive the byte stream, close() does the FIN.
- Socket gains state + 32-bit snd_nxt/rcv_nxt (big-endian, add-with-carry-fold).
- tcp_send_seg builds IP+TCP with a pseudo-header checksum; the SYN carries an
MSS option (200) so the peer never sends a segment larger than our 256-byte
frame buffer (we don't do IP reassembly).
- tcp_in state machine: SYN_SENT->ESTABLISHED on SYN-ACK, buffers in-order data
and ACKs it, handles FIN -> recv() returns 0 (EOF).
- No retransmission: the GB<->host link is lossless and the host's real TCP
owns the internet side - which removes TCP's hardest part.
- net_pump now processes one frame per call so recv drains each segment before
the next arrives (single rx slot, no overwrite).
wget.c is now a thin socket client: connect -> send "GET / HTTP/1.0" -> recv to
EOF -> print. Verified end to end against a host HTTP server:
/# wget 10.0.0.1
HTTP/1.0 200 OK
Hello from a real HTTP server, fetched by a Game Boy!
with a clean SYN/SYN-ACK/ACK ... PSH ... FIN/ACK trace on the wire.
Diffstat (limited to 'src/hram.asm')
0 files changed, 0 insertions, 0 deletions
