You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TermTCP/QUICKSTART_CLI.md

5.6 KiB

TermTCP CLI - Quick Start

60 Second Setup

1. Compile (30 seconds)

cd termtcp_cli
make -f Makefile_CLI

2. Run (5 seconds)

./termtcp

3. Connect (25 seconds)

> list                    # See available hosts
> connect 0              # Connect to first host
> Hello from TermTCP!    # Send a message
> disconnect             # Close connection
> quit                   # Exit

What You Get

Lightweight TCP terminal client
No GUI dependencies (CLI only)
Multiple host configuration
Session logging
Color output
~400 lines of code
Single file, no external libs


First Steps

1. Build

make -f Makefile_CLI
./termtcp

First run creates: ~/.termtcprc

2. Configure Hosts

Edit ~/.termtcprc:

# Your hosts here
localhost 8011 My Local System
example.com 9000 Remote Server

3. Use It

> list              # Show hosts
> connect 0         # Connect
> Type anything     # Send to server
> disconnect        # Close connection

Common Commands

connect [0-4]      Connect to host 0-4
disconnect         Disconnect
list               Show configured hosts
log on/off         Enable/disable logging
color on/off       Enable/disable colors
status             Show connection status
help               Show command help
quit               Exit program

Command-Line Usage

# Auto-connect to host 0
termtcp -c 0

# Auto-connect with logging
termtcp -c 0 -l

# Disable colors
termtcp -n

# Show help
termtcp -h

File Locations

File Purpose
~/.termtcprc Host configuration
hostname_port_*.log Session logs (if enabled)

Building

Requirements

  • GCC/Clang
  • Linux/macOS/BSD

Commands

make -f Makefile_CLI         # Build
make -f Makefile_CLI run     # Build & run
make -f Makefile_CLI debug   # Debug build
make -f Makefile_CLI clean   # Clean
make -f Makefile_CLI install # Install

Troubleshooting

Problem Solution
"Connection refused" Check host/port in config
"Connection timeout" Server might be down
Terminal frozen Press Ctrl+C or type quit
Colors look wrong Try color off
Can't find hosts Check ~/.termtcprc format

Configuration Format

File: ~/.termtcprc

# Comments start with #
# Format: host port name

localhost 8011 My System
example.com 9000 Remote

That's it! No quotes needed.


Real-World Examples

Connect to BBS

# In ~/.termtcprc:
bbs.example.net 9000 Classic BBS

# Then:
termtcp
> connect 0
> help     (usually gets you started)

Check Remote System

termtcp -c 0
> QUERY
> STATUS
> quit

Debug Connection Issues

termtcp -c 0 -l
> [try to do something]
# Check the log file created

Keyboard Shortcuts

Ctrl+C     Exit immediately
Enter      Send line to server
/command   Use / prefix for commands

Wait, that last one isn't real. Just type commands normally:

help               (actual command)
/help              (NOT needed)

Features at a Glance

Connect to TCP servers
Send/receive text
Multiple host profiles
Automatic session logging
Colored output (optional)
Configuration file support
Command system
Status display


Program Flow

Start
  ↓
Load ~/.termtcprc
  ↓
Show prompt
  ↓
User enters command
  ├─ "connect" → Connect to server
  ├─ "send data" → Send to server
  ├─ "log" → Start/stop logging
  └─ "quit" → Exit
  ↓
Repeat until quit
  ↓
Cleanup & exit

Comparing CLI to GTK3 Version

Use CLI when:

  • No GUI environment
  • Lightweight needed
  • Scripting/automation
  • Remote connection
  • Simple connectivity

Use GTK3 when:

  • Visual interface needed
  • Multiple simultaneous connections
  • Port monitoring required
  • Desktop environment available

Tips & Tricks

Auto-connect on startup

termtcp -c 0        # Connects to host 0

Log everything

termtcp -c 0 -l     # Connects and starts logging

Script with pipes

echo "QUERY" | termtcp -c 0

Create alias

# In ~/.bashrc:
alias mybbс='termtcp -c 0'

# Then just:
mybbs

Logging Details

When log on is enabled:

  • File created: hostname_port_YYYYMMDD_HHMMSS.log
  • Contains: All sent/received data with timestamps
  • Format: [HH:MM:SS] SEND/RECV: data
  • Location: Current working directory

Example:

[14:35:22] SEND: HELLO
[14:35:23] RECV: Welcome!
[14:35:24] SEND: QUERY

Performance

Metric Value
Binary Size ~40KB
Memory Usage ~50KB
Startup Time <100ms
CPU Usage Minimal
Max Line 512 chars

Getting Help

In the program:

> help              # Show commands
> status            # Show connection status
> list              # Show configured hosts

In the shell:

termtcp -h          # Show options

Next Steps

  1. Build: make -f Makefile_CLI
  2. Run: ./termtcp
  3. Configure: Edit ~/.termtcprc
  4. Connect: Type connect 0
  5. Use: Send and receive data
  6. Log: Enable with log on if needed

Quick Reference Card

START:      termtcp
SHOW HELP:  help
LIST HOSTS: list
CONNECT:    connect 0
SEND:       type anything
LOG ON:     log on
LOG OFF:    log off
COLORS ON:  color on
COLORS OFF: color off
STATUS:     status
EXIT:       quit

You're ready! Run make -f Makefile_CLI && ./termtcp 🚀

For more details, see: README_CLI.md

Powered by TurnKey Linux.