Skip to content

Machinegon/socket-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

socket-mock

DESCRIPTION

A small utility that allows you to listen/reply to incoming TCP socket communication on specified port number.

COMPILATION DIRECTIVES

Use any compiler with the standard c library, standard c++ library and posix library.

  • Clone the project
  • Edit the makefile and set CXX to your specific compiler
  • Make

USAGE

The program must be started with the following parameters.

  • [--port=p] -> Port number (Must be root under 1024)
  • [--ip ] -> Server IP, normally your ethernet interface IP address
  • [--file ] -> Path to a command/response configuration file

COMMAND/RESPONSE CONFIGURATION FILE

If a command/response file is set, the server will parse a file to look for recognized commands and answer the related response. The file must be set up the following way:

[COMMAND] || [RESPONSE]

[COMMAND] || [RESPONSE]

Each line has a command and a corresponding response and the "||" serve as a delimiter. Wildcard character "*" might be used to look only for the start or/and the end of a command. For example:

PARTIALCOMMAND||{"jsonResult": "OK"}

PARTIALCOMMAND*||hello world

About

A lightweight posix-c socket server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published