{"id":16563746,"url":"https://github.com/nathsou/socketify","last_synced_at":"2025-03-05T07:18:31.625Z","repository":{"id":36430582,"uuid":"40735584","full_name":"nathsou/Socketify","owner":"nathsou","description":"Lightweight Java network library unifying TCP and UDP.","archived":false,"fork":false,"pushed_at":"2015-08-19T01:31:31.000Z","size":200,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-15T19:52:30.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/nathsou.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}},"created_at":"2015-08-14T20:52:32.000Z","updated_at":"2020-09-20T22:56:54.000Z","dependencies_parsed_at":"2022-09-13T22:02:17.316Z","dependency_job_id":null,"html_url":"https://github.com/nathsou/Socketify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathsou%2FSocketify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathsou%2FSocketify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathsou%2FSocketify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathsou%2FSocketify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathsou","download_url":"https://codeload.github.com/nathsou/Socketify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241982637,"owners_count":20052535,"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":[],"created_at":"2024-10-11T20:42:12.956Z","updated_at":"2025-03-05T07:18:31.601Z","avatar_url":"https://github.com/nathsou.png","language":"Java","readme":"## Usage\n\nSocketify enables you to create client/server couples using TCP and/or UDP protocols.\n\nThe library provides the following classes:\n* *TcpClient* and *TcpServer* for the TCP protocol.\n* *UdpClient* and *UdpServer* for the UDP protocol.\n* *SocketifyClient* and *SocketifyServer* for both protocols.\n\nAll of those Client/Server couples share the same methods, so it's as easy to create a TCP and UDP couple as just a TCP one !\n\n```java\n\n//The SocketifyServer class accepts an optional 3rd argument representing the UDP port.\nSocketifyServer server = new SocketifyServer(1621, 1789); int tcpPort, int udpPort (optional)\nserver.listen(); //Starts the server\n\nSocketifyClient client = new SocketifyClient(\"localhost\", 1621, 1789); ////String address, int tcpPort, int udpPort (optional)\n\nclient.connect();\n\nclient.send(\"Hoy !\", ProtocolType.TCP);\n\nserver.sendToAll(\"How are you ?\", ProtocolType.UDP);\n\nclient.disconnect();\n\nserver.close();\n\n```\n\n##Event handling\n\nServer classes fire the following events:\n* PacketReceivedEvent\n* PacketSentEvent\n\nClient classes fire the following events:\n* ClientConnectedEvent\n* ClientDisconnectedEvent\n* PacketReceivedEvent\n* PacketSentEvent\n\n```java\n\nserver.addPacketReceivedListener(new PacketReceivedListener() {\n   @Override\n   public void PacketReceived(PacketReceivedEvent e) {\n      System.out.println(\"Server received (\" + e.getProtocol() + \"): \" + e.getPacket() + \" from \" + e.getSenderId());\n   }\n});\n\n//Using lambda expressions:\n\nserver.addPacketReceivedListener(e -\u003e System.out.println(\"Server received (\" + e.getProtocol() + \"): \" + e.getPacket() + \" from \" + e.getSenderId()));\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathsou%2Fsocketify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathsou%2Fsocketify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathsou%2Fsocketify/lists"}