IoTSense is a lightweight and efficient TCP-based protocol designed for transmitting sensor data between IoT devices. This repository contains a Go implementation of the IoTSense protocol with a client and server application.
- Simple and efficient packet structure
- Customizable packet types for data transmission and termination
- Easy-to-understand Go implementation
- Command-line input for sending sensor data
- Go 1.14+ installed
- Clone the repository:
git clone https://github.com/chandiwalaaadhar/iot-sense-tcp-protocol.git
- Change to the repository directory:
cd iot-sense-tcp-protocol
- Compile the client and server applications:
go build -o client client/main.go
go build -o server server/main.go
- Run the IoTSense server:
/server/main
- In a separate terminal, run the IoTSense client:
/client/main
- Follow the prompts to enter the sensor data and sensor ID to send to the server. The server will display the received data and sensor ID in the Client Terminal.
this is a test message>1
The client application (client/main.go) allows users to input sensor data and sensor ID from the command line. It connects to the server, sends the data using the IoTSense protocol, and sends a termination packet to signal the end of the transmission.
The server application (server/main.go) listens for incoming connections on a specified port and processes incoming IoTSense packets. When a data packet is received, the server prints the sensor data and sensor ID.
The IoTSensePacket
structure represents packets in the IoTSense protocol:
type IoTSensePacket struct {
PacketType byte
SensorID uint16
DataLength uint16
Data []byte
}
- Fork the repository
- Create a new feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/new-feature
) - Create a new Pull Request