Skip to content

Az0202/NetTalk-Simple-TCP-Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

NetTalk-Simple-TCP-Chat

Overview

This project is a minimalistic chat application written in C that uses TCP/IP networking to facilitate real-time communication between a server and client. The application supports both server and client functionalities, enabling two users to exchange messages over a network.

Features

  • Server and Client Modes: The application can be started in either server or client mode.
  • Ephemeral Ports: When started without specifying a port, the server picks a random port in the ephemeral range.
  • Polling: Uses the poll system call to handle simultaneous input from the terminal and network socket without multi-threading.
  • Timeouts: Implements a 1-minute timeout on the poll to ensure the application remains responsive.
  • Buffer Management: Handles up to 4096 bytes of data transmission at a time.

Compilation and Usage

Prerequisites

Ensure you have a C compiler (like gcc) and the standard C libraries available on your system. This application uses the sys/socket.h, arpa/inet.h, and unistd.h libraries, which are typically available on Unix-like systems.

Compilation

Compile the application using the following command:

gcc nettchat.c -o nettchat

### Running the Application
To run the application:

* Server Mode:
./nettchat [port]         # for server

* Note: If no port is specified, the server will select a random ephemeral port.

* Client Mode:
./nettchat [server IP] [server port]   # for client

## Ensure to replace [server IP] and [server port] with the actual IP address and port number of the server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages