A simple peer-to-peer file sharing system built in Go that allows you to send files between devices over a local network.
This project is open source and available under the MIT License.
- ✅ Send files over LAN or same Wi-Fi network
- ✅ No internet connection required
- ✅ Simple CLI interface
- ✅ Supports any file type
- ✅ Shows file metadata (name, size)
- ✅ Progress feedback during transfer
go run main.go send <ip> <port_no>You'll be prompted to enter the file path (just the filename if it's in the current directory, or full path).
go run main.go receive <port_no>go run main.go receive 9000This will:
- Start listening on port 9000
- Show your IP address for others to connect to
- Wait for incoming file transfers
go run main.go send 192.168.1.5 9000This will:
- Prompt you to enter the file path (e.g., "document.pdf" or "C:\Users\user\file.txt")
- Connect to the device at IP
192.168.1.5on port 9000 - Transfer the file content
You can test the system on the same machine using localhost:
Terminal 1 (Receiver):
go run main.go receive 9000Terminal 2 (Sender):
go run main.go send localhost 9000- Both devices must be on the same network (LAN/Wi-Fi)
- The receiver's port must be accessible (not blocked by firewall)
- No internet connection required
- Reads file from disk
- Connects to receiver's IP:PORT via TCP
- Sends filename and file size first
- Streams file content over the connection
- Closes connection when complete
- Starts TCP listener on specified port
- Accepts incoming connection
- Reads filename and file size metadata
- Creates output file
- Receives and writes file content
- Confirms successful transfer
The system handles common errors:
- File not found
- Network connection issues
- Invalid IP addresses or ports
- Permission errors
- Incomplete transfers
- Large file chunking (for files >100MB)
- Connection retry mechanism
- File encryption
- Multiple file transfers
- Progress bars
- Peer discovery over LAN
- Checksum verification
- "Connection refused": Make sure the receiver is running and listening on the correct port
- "File not found": Check the file path and ensure the file exists
- "Permission denied": Ensure you have read permissions for the source file and write permissions for the destination
- Firewall blocking: Check if your firewall is blocking the port
# Test if port is reachable
telnet <receiver_ip> <port>This project is open source and available under the MIT License. 5. Receives and writes file content 6. Confirms successful transfer
The system handles common errors:
- File not found
- Network connection issues
- Invalid IP addresses or ports
- Permission errors
- Incomplete transfers
- Large file chunking (for files >100MB)
- Connection retry mechanism
- File encryption
- Multiple file transfers
- Progress bars
- Peer discovery over LAN
- Checksum verification
- "Connection refused": Make sure the receiver is running and listening on the correct port
- "File not found": Check the file path and ensure the file exists
- "Permission denied": Ensure you have read permissions for the source file and write permissions for the destination
- Firewall blocking: Check if your firewall is blocking the port
# Test if port is reachable
telnet <receiver_ip> <port>