Skip to content

Commit

Permalink
Merge pull request #4 from computersarecool/development
Browse files Browse the repository at this point in the history
Readme and minor comment update
  • Loading branch information
computersarecool authored Feb 13, 2021
2 parents f1d6751 + 83f9261 commit 6c315e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bin/*

build/*
!build/.gitkeep
.vs/
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Really this library is not that big of a deal and most sources suggest using a l
- Windows

## To Build
- `simple_cpp_sockets.h` is header-only (just include it in your project).
- To build and run the test application on Linux:
- The library `simple_cpp_sockets.h` is header-only (just include it in your project).

- To build and run the test application on Linux open a terminal and run:
- `cd src`
- `g++ main.cpp -o main`
- `./main`
Expand All @@ -29,12 +30,10 @@ Really this library is not that big of a deal and most sources suggest using a l
## Functionality
`main.cpp` is a simple functioning example (not all errors are handled gracefully).

Run the compiled demo application from the command line.
It is a CLI that allows you to interactively make a:

UDP or TCP
The compiled test application is a CLI that allows you to interactively create a:

server or client
- UDP or TCP
- server or client

By asking for:
- protocol
Expand All @@ -50,18 +49,18 @@ If server:


## To Use
simple_cpp_sockets.h contains classes for UDP and TCP servers and clients.
`simple_cpp_sockets.h` contains classes for UDP and TCP servers and clients.

An example looks like:
```
UDPServer server(socket_port);
int bind_status = server.socket_bind();
```
Look at main.cpp for the complete needed code.
Look at `main.cpp` for the a complete example.

## Project Structure
- `src/simple_cpp_sockets.h` is the library
- `src/main.cpp` is a simple demo application
- `src/main.cpp` is a demo application

## Extra Notes
- There is [a lot more that could be done](http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html) but this is outside the goals of this project
Expand Down
4 changes: 2 additions & 2 deletions src/simple_cpp_sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef int SOCKET;
#endif


// Possible errors
// These could also be enums
const int socket_bind_err = 3;
const int socket_accept_err = 4;
const int connection_err = 5;
Expand Down Expand Up @@ -87,7 +87,7 @@ class TCPServer : public Socket
Socket::Socket(const SocketType socket_type) : m_socket(), m_addr()
{
#ifdef WIN32
// Initialize the WSDATA if no socket instances exist
// Initialize the WSDATA if no socket instance exists
if(!s_count)
{
WSADATA wsa;
Expand Down

0 comments on commit 6c315e9

Please sign in to comment.