Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCPTunnel

A lightweight multiplayer TCP chat for Windows cmd terminals

.NET Framework Platform Transport Build

Host a chat, connect multiple people, and keep everything inside one portable executable.


TCPTunnel is a nostalgic console chat brought back to life with a stable asynchronous TCP core, an animated terminal interface, automatic UPnP port mapping, and a portable single-file application binary.

Important

Chat traffic is currently sent as plain TCP without encryption. Do not use TCPTunnel for confidential conversations on untrusted networks, encryption in my plans!

Highlights

Feature Description
🌐 Multiplayer Hub One process hosts the TCP Hub and connects the local user—no second console window required.
💬 Reliable chat Ordered message delivery, preserved input during incoming messages, and clean disconnect handling.
@ Mentions Existing participants are highlighted by @durak go drink vodka; direct mentions blink in-chat and request attention on the Windows taskbar.
🧵 Asynchronous server Multiple clients are handled without creating a dedicated thread for every connection.
🛡️ Stability limits Authentication timeout, message-size limits, rate limiting, duplicate nickname protection, and strict UTF-8 validation.
🖥️ ConsoleGraphics Animated menu, bounded text rendering, fast frame drawing, and an optional classic plain-console mode.
🔌 UPnP / NAT-PMP Attempts UPnP first, falls back to NAT-PMP, and removes the selected TCP mapping on shutdown.
📦 Single EXE Open.Nat.dll is embedded into TCPTunnel.exe; no adjacent application DLLs are required.
🎨 Saved profiles Nickname, recent endpoint, language, colors, and snake design are restored from a per-user profile.

Quick start

Host a chat

  1. Run TCPTunnel.exe.
  2. Enter a nickname.
  3. Select Create server.
  4. Choose a TCP port or press Enter to use 9091.
  5. Share your public IP address and port with the other participants.
  6. Have fun!

The Hub runs in the background of the same process, while the host connects locally through 127.0.0.1.

Join a chat

  1. Run TCPTunnel.exe.
  2. Select Connect to server.
  3. Enter the host name or IP address.
  4. Enter the server port.
  5. Have fun! x2

Chat commands

Command Action
/help Show the available commands and their syntax.
/status Show the local Hub and UPnP status.
/ping <host:port> Check an endpoint locally without sending the command to other participants.
/clear Clear only your local chat history while keeping the session and interface active.
/stop Hub owner: stop the local Hub. Participant: pause or resume their synchronized border snake.
/kick @nickname ["reason"] Local Hub owner: notify and disconnect one participant.
/exit Leave the current chat and return to the menu.

How it works

flowchart LR
    ClientA["Remote client A"] <--> HubA
    ClientB["Remote client B"] <--> HubA
    Host["Host client"] <--> HubA["TCP Hub A"]
    ClientC["Remote client C"] <--> HubA
    HubB["TCP Hub B"] <--> ClientD["Remote cliend D and owner of  Hub B"] <--> HubA
    ClientN["Remote client N"] <--> HubB
    ClientX["Remote client X"] <--> HubB
Loading

The Hub authenticates each nickname, receives length-prefixed UTF-8 messages, and broadcasts them to all other authenticated clients in a consistent order. Even if you hosting an other hub, you can connect to anyone and checking by doing /status there to see a status of YOUR hub

Protocol limits

  • Maximum encoded frame: 16 KiB
  • Maximum chat message: 2,000 characters
  • Authentication timeout: 7 seconds
  • Rate limit: 5 messages/second, with a short burst allowance
  • Nickname length: 3–20 characters, unique per Hub

Command-line options

TCPTunnel.exe [options]
Option Example Description
-nickname <name> -nickname HeWhoMustNotBeNamed Set the nickname before opening the menu.
-create <port> -create 9091 Start a Hub and connect to it locally.
-connect <host:port> -connect cool.tcptunnel.hub:9091 Connect directly to a Hub.
-ping <host:port> -ping cool.tcptunnel.hub:9091 Check whether a TCP endpoint is reachable.
-no-graphics -no-graphics Disable ConsoleGraphics without CG's option
-graphics <on|off> -graphics off Explicitly enable or disable ConsoleGraphics. (Can be switched in CG's options)
-self-test -self-test Verify that the embedded dependencies and argument parsing works correctly.
-stress-test -stress-test Run the loopback broadcast, framing, ordering, and targeted-disconnect stress suite.
-lang <en/ru> -lang ru (by defaule) Switch current language. Have the option in main menu.

Example:

TCPTunnel.exe -nickname VodkaMan -connect cool.tcptunnel.hub:9091 -graphics on -lang en

Internet connectivity and NAT

TCPTunnel first attempts to create a UPnP mapping for the selected TCP port, then falls back to a renewable NAT-PMP lease. This works only when at least one of these protocols is enabled and supported by the router.

If other people cannot connect, check the following:

  1. Allow TCPTunnel.exe through Windows Firewall.
  2. Forward the selected TCP port manually on the host router.
  3. Confirm that the ISP provides a public IP address.

Note

UPnP cannot bypass strict NAT or carrier-grade NAT (CGNAT). Those networks require a public relay/VPS, a VPN with port forwarding, or another tunnelling solution.

Requirements

  • Windows
  • .NET Framework 4.7.2 or newer

Modern Windows installations commonly include a compatible .NET Framework runtime. If the application does not start, install the .NET Framework 4.7.2 runtime or a newer 4.x version.

Building from source

Visual Studio

  1. Open TCPTunnel.sln.

  2. Select the Release configuration.

  3. Press Ctrl + B.

  4. Find the portable executable at bin\Release\TCPTunnel.exe.

    or just go releases lol

Command line

dotnet restore TCPTunnel.sln -p:RestorePackagesConfig=true
dotnet build TCPTunnel.sln -c Release

The Release directory also contains debugging and runtime metadata, but only TCPTunnel.exe needs to be distributed. The target computer still needs a compatible .NET Framework runtime.

The immutable default.cfg is embedded in that executable. Personal profiles are generated under %LocalAppData%\TCPTunnel\profiles; they are runtime data and do not need to be distributed with the program.

Verify a copied executable at any time:

.\TCPTunnel.exe -self-test

Expected output:

TCPTunnel self-test: OK

Project structure

TCPTunnel
├── Broadcaster.cs              # Ordered multi-client broadcasting
├── ApplicationSettings.cs      # Atomic per-user profile persistence
├── Client.cs                   # Client state, sending, and rate limits
├── ConsoleGraphic.cs           # Console frame and bounded output
├── ConsoleTitleAnimator.cs     # Console title live animation, works only when CG's ON
├── ConsoleTheme.cs             # Customizable terminal color palette
├── EmbeddedAssemblyResolver.cs # Single-EXE dependency loader
├── HubEventProtocol.cs         # Versioned Hub event messages
├── Localization.cs             # Translations container
├── Menu.cs                     # Menu and launch arguments
├── MessageProtocol.cs          # Length-prefixed UTF-8 protocol
├── NetWorker.cs                # Authentication, sessions, and UPnP
├── ServerInterface.cs          # Hub lifecycle and accept loop
├── SnakeProtocol.cs            # Custom UI-snake profile transmission
├── StabilityTests.cs           # Loopback network stress checks
├── SystemMessageProtocol.cs    # "Language" for system ivents
├── UserInterface.cs            # Interactive chat and input rendering
├── WindowAttention.cs          # Windows taskbar attention notifications

Roadmap

  • [V] Add english language support
  • End-to-end encrypted chat
  • Relay mode for strict NAT and CGNAT
  • Improved connection discovery and invitations
  • Automated integration tests

Made with nostalgia by alextmsv.