aboutsummaryrefslogtreecommitdiff
path: root/server.c
Commit message (Collapse)AuthorAgeFilesLines
* Updated box, send and server examples with new codeRaymaekers Luca2025-03-181-0/+3
|
* Added markdown support for messagesRaymaekers Luca2024-11-181-2/+6
|
* create archived.md for tasks which are doneRaymaekers Luca2024-11-081-0/+4
|
* Connect BIFD first to avoid errorsRaymaekers Luca2024-11-041-55/+91
|
* Fixed not setting unifd and bifdRaymaekers Luca2024-11-031-27/+32
|
* Add id field to HeaderMessage for simplifyingRaymaekers Luca2024-11-031-224/+238
| | | | - Changed bracket style as well
* Added ID system with 1 and 2-way communicationRaymaekers Luca2024-11-031-179/+388
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each client now has an ID that is permanently stored to ID_FILE location. To implement this each client now uses two connections to the server, one for bidirectional communication and one for unidirectional communication. This makes it easier to not receive unexpected message. Also each client and server now has a Client struct that represents a client and a clientsArena associated with it. Minor changes: - Added logging to LOGFILE, that can be turned with LOGGING macro. - Added more error types - Added error handling on server - Added error messages - Added convenience functions - Added disconnectAndNotify() function for convenience - Use recvTextMessageResult as multiple-value-return-type instead of ** - Separated protocol stuff into protocol.h - Added Result types when wanting to return multiple values - Do not allocate arena's with malloc - Added recvAnyMessageType for receiving messages that do not need to be stored - Add UNIFD and BIFD file descriptors for separating requests chatty.c: - Convert ID to string in screen_home() - Removed the fds global variable - Pass fds to threadReconnect - Implement faster sleep with nanosleep(2) - Close file descriptors when failed so we do not have too many file descriptors open server.c: - Send presence messages on disconnect & connect - renamed i to conn
* Refactor server code into functionsRaymaekers Luca2024-10-301-101/+132
| | | | | | - disconnect(): for disconnecting a client and deinitializing it - sendToOthers(): for sending a message to all other clients - initClient(): for initializing a client
* Added protocolRaymaekers Luca2024-10-301-82/+177
| | | | | | | | | | | | | | | | | | Use a protocol defined in `README.md` and `chatty.h` for sending messages. Another big change is the clientsArena which now stores metadata for the connection such as the author's name. Misc: - Merged arena.h and common.h into chatty.h - removed all the unused code from arena.h as it was not very useful and would not win me any time. - Added compile_flag.txt - Changed formatting - Added more log messages - Added more asserts - Added bool type via enum
* Use dynamic limits for buffersRaymaekers Luca2024-10-261-12/+26
| | | | | | | | Use arenas where possible to have growable buffers - Use of bufArena in server and client for receiving&sending messages - Use of inputArena in client Also organized code
* Put v2 code in root folderRaymaekers Luca2024-10-261-0/+149
|
* Archive code into v1/ directoryRaymaekers Luca2024-10-241-147/+0
| | | | | The code was written too fast and I deemed that it would be better to make a new draft.
* Moved common.c to common.hRaymaekers Luca2024-10-211-1/+1
| | | | | - fixed bug(server.c): `on` not being 32 bytes - cleanup
* Added common code for messagesRaymaekers Luca2024-10-211-17/+17
| | | | | | - add: send_message, receive_message functions - change: use u8, u16, u32, where possible - fix: use PORT in server.c
* Added README.mdRaymaekers Luca2024-10-211-24/+0
|
* Added mvp implementations of the server and client for testingRaymaekers Luca2024-10-201-12/+9
|
* add serialization to file codeRaymaekers Luca2024-10-191-2/+4
|
* Initial commitRaymaekers Luca2024-10-171-0/+172