Skip to content

marksniper/UnixSocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UNIX Socket

Unix socket is made up of two file, written in C, defined as follow:

  1. server.c:
    • open socket
    • listen continuously socket, waiting connection from client
    • receive message from client and print on standard output the message
    • save received message in connection.txt, if file doesn't exist, server provides to create its
    • send response to client
  2. client.c :
    • open socket in order to communicate to server
    • send message to server
    • receive message from server
    • close socket
    • open file and write 10 random number in random.txt, if file doesn't exist, client provides to create its
    • print content character by character
    • read all file content and print buffer variable as string

LINKS

Advanced Programming in the UNIX Environment Understand inet Developing C programs on Mac OS

TEST

Use Makefile to test code Compile: move in directory when the code is stored, with

cd PATH

Launch make command

make

Launch server

./Server_TCP 

Launch client

./Client_TCP

Clean

make clean

Authors

  • Benedetto Marco Serinelli - Initial work

Acknowledgments

The code is tested only on Ubuntu 18.04.3 LTS and macOS 10.13.

About

Example of Unix Socket client and server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published