2022-05-20 14:09:25 +00:00
# BachelorThesis
2022-05-20 10:25:09 +00:00
## About
This repository contains source codes for client-server network application capable to communicate with distance laser sensor DLS-C 15 via RS-232 interface, which was implemented as a part of bachelor thesis.
## Author
Author: Jozef Simko
School year: 3., Bachelor study, 2021/22
Study program: Computer Networks
Organization: Technical University of Kosice (TUKE), Faculty of Electrical Engineering and Informatics (FEI)
## Building
Implemented and tested on:
| Platform | OS | compiler |
|-----------------|---------------------------|-------------------------------------------------|
| Linux | Ubuntu 20.04.1 WLS2 | gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) |
| Windows | Windows 10.0.19043 | gcc version 11.2.0 (MinGW-W64 x86_64-posix-seh) |
| Raspberry Pi | Linux raspberrypi 5.10.17 | gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1) |
2022-05-20 13:38:52 +00:00
#### LINUX
2022-05-20 14:09:25 +00:00
* CLIENT
- `gcc client.c -Wall -Werror -Wextra -o client`
* SERVER
- `gcc server.c rs232.c -Wall -Werroe -Wextra -o client`
2022-05-20 13:38:52 +00:00
#### WINDOWS
2022-05-20 14:09:25 +00:00
* CLIENT
- `gcc client.c -Wall -Wextra -lwsock32 -o client`
* SERVER
- `gcc server.c rs232.c -lwsock32 -Wall -Werror -Wextra -o client`
2022-05-20 10:25:09 +00:00
2022-05-20 13:38:52 +00:00
## Launch
2022-05-20 14:03:24 +00:00
### Server
2022-05-20 13:38:52 +00:00
Server can be launched with 1 or 2 input parameters. The number of parameters determines what mode will be used - manual or automatic mode.
2022-05-20 10:25:09 +00:00
2022-05-20 14:20:24 +00:00
**port** - specific number to identify communication processes of server
2022-05-20 10:25:09 +00:00
2022-05-20 14:11:29 +00:00
**[config_file]** - configuration file with exact name of variables
2022-05-20 10:25:09 +00:00
2022-05-20 14:07:55 +00:00
#### Manual mode
- server waits for input commands from client, sends them to laser sensor and returns results back to client
- `./server <port>`
2022-05-20 13:38:52 +00:00
2022-05-20 14:07:55 +00:00
#### Automatic mode
- server loads variables from configuration file *config.txt* , starts measuring and sends results to client continuously.
- `./server <port> [config_file]`
2022-05-20 13:38:52 +00:00
2022-05-20 14:03:24 +00:00
### Client
2022-05-20 13:38:52 +00:00
Client has to be lauched with 2 input parameters.
2022-05-20 10:25:09 +00:00
2022-05-20 14:20:24 +00:00
**IP address** - IP address of server the client tries to connect
2022-05-20 13:38:52 +00:00
2022-05-20 14:20:24 +00:00
**port** - port number of server
2022-05-20 14:21:41 +00:00
> `./client <IP address> <port>`
2022-05-20 14:07:55 +00:00
2022-05-20 14:03:24 +00:00
### Demo
No input parameters.
Macros defines multiple variables used in demo program, which demonstrates connection to server in automatic mode and process of resulting data.
```c
#define IP_ADDRESS "192.168.0.101" // IP address of server
#define PORT 32500 // server port number
#define MAX_VALUE 1265 // upper limit (depends on used units)
#define MIN_VALUE 1200 // lower limit (depends on used units)
```
2022-05-20 10:25:09 +00:00
## References
[WinLibs GCC ](https://winlibs.com )
2022-05-20 14:03:24 +00:00
2022-05-20 13:38:52 +00:00
[RS-232 library ](https://www.teuniz.net/RS-232/ )