{"id":16787077,"url":"https://github.com/ygboucherk/simplesocket","last_synced_at":"2025-06-16T08:35:06.674Z","repository":{"id":136088025,"uuid":"336630434","full_name":"ygboucherk/simpleSocket","owner":"ygboucherk","description":"A C library for seamlessly create sockets","archived":false,"fork":false,"pushed_at":"2021-02-06T22:52:55.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T09:43:02.007Z","etag":null,"topics":["c","easing-functions","library","tcp-socket"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ygboucherk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-06T20:32:09.000Z","updated_at":"2021-04-01T06:03:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd7b8545-8fa4-4269-833f-2b2bcfde120e","html_url":"https://github.com/ygboucherk/simpleSocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2FsimpleSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2FsimpleSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2FsimpleSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2FsimpleSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ygboucherk","download_url":"https://codeload.github.com/ygboucherk/simpleSocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950792,"owners_count":20373664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","easing-functions","library","tcp-socket"],"created_at":"2024-10-13T08:14:11.745Z","updated_at":"2025-03-16T23:40:59.629Z","avatar_url":"https://github.com/ygboucherk.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simpleSocket\nSockets as easy as in python !\n\n### Importing lib\nIf you want to init lib, you should put `simpleSocket.h` file within the same directory as C file.\n\nThen, import it using `#include \"simpleSocket.h\"` !\n\n### Creating new socket\nYou can create a new socket with `newSocket(ip, port)`.\nFunction will return socket, so full command is `socket = newSocket(ip,port)`\n*note : ip is a string, and port is an integer*\n\n\n### Sending data\nSending data protocol is `send(socket variable, data, lenght of data, 0)`\nSo sending hello world on a socket named `sock1`lead to type (I know, I didn't add the semicolon at the end of line) : `send(sock1,\"Hello world\",strlen(\"Hello world\"),0)`\n\n\n### Receiving data\nFor receiving data, you should enter `recv(socket variable, variable to write, lenght to read, 0)`\nLenght to read is the lenght of tcp buffer that will be read (it is never fully instant, so a buffer stores data, and we read this buffer).\n\nSo receiving 64 bits of data from a socket named `sock1`, and writing received data to a `textVariable` variable will lead to `recv(sock1,textVariable,64,0)` !\n\n\n### Example\nHere's an example of\n```c\n#include \"simplesocket.h\"\n#include \u003cstdio.h\u003e\n\nint main() {\n  int sock1;\n  char buffer[100] = \"Hello world\";\n  char recvbuffer[100];\n  sock1 = newSocket(\"52.20.16.20\",30000);\n  send(sock1,buffer,strlen(buffer),0);\n  recv(sock1,recvbuffer,100,0);\n  printf(\"received : %s\\n\",recvbuffer);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fygboucherk%2Fsimplesocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fygboucherk%2Fsimplesocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fygboucherk%2Fsimplesocket/lists"}