{"id":21988894,"url":"https://github.com/alessandro-salerno/framedtcp","last_synced_at":"2026-01-03T19:06:54.263Z","repository":{"id":164585852,"uuid":"640048981","full_name":"Alessandro-Salerno/FramedTCP","owner":"Alessandro-Salerno","description":"A simple Java networking library that encapsulates messages using length-prefixing","archived":false,"fork":false,"pushed_at":"2024-07-14T14:41:36.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T10:46:56.999Z","etag":null,"topics":["framing","framing-protocols","jar","java","java-library","java-socket-programming","java-sockets","library","network-library","networking-library","socket","socket-programming","tcp","tcp-framework"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alessandro-Salerno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-05-12T21:17:28.000Z","updated_at":"2024-09-27T09:28:55.000Z","dependencies_parsed_at":"2024-03-22T11:15:48.139Z","dependency_job_id":null,"html_url":"https://github.com/Alessandro-Salerno/FramedTCP","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alessandro-Salerno%2FFramedTCP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alessandro-Salerno%2FFramedTCP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alessandro-Salerno%2FFramedTCP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alessandro-Salerno%2FFramedTCP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alessandro-Salerno","download_url":"https://codeload.github.com/Alessandro-Salerno/FramedTCP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244148562,"owners_count":20406204,"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":["framing","framing-protocols","jar","java","java-library","java-socket-programming","java-sockets","library","network-library","networking-library","socket","socket-programming","tcp","tcp-framework"],"created_at":"2024-11-29T19:26:22.617Z","updated_at":"2026-01-03T19:06:49.233Z","avatar_url":"https://github.com/Alessandro-Salerno.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FramedTCP\nA simple Java networking library that encapsulates messages using length-prefixing\n\n## The problem\nWhen you send messages over TCP sockets, you're not guaranteed to receive those messages exactly how you sent them.\nTCP only guarantees that you'll receive all packets in the correct order, but does not keep bounderies between messages.\nThis means that if you were to read the entire buffer, you may get a partial message or multiple messages at once.\n\n## The solution\nA possible solution is to encapsule messages into an application-level frame that also carries the **length** of the message. This way, the receiver always knows where a message starts and where it ends.\n\n## Build\nThis project uses Maven as its build system.\n\n## How to use\nThe library provides a series of classes that you can use to take advantage of its features. Unfortunatelly these are **NOT** standardized for now.\nThis is how you build an echo server, for example.\n\n### Server\n```java\ntry (ServerSocket serverSocket = new ServerSocket(8000)) {\n    Socket client = serverSocket.accept();\n    FramedReader reader = new FramedReader(client.getInputStream());\n    FramedWriter writer = new FramedWriter(new OutputStreamWriter(client.getOutputStream()));\n    writer.writeBytes(reader.readBytes());\n} catch (Exception e) {\n    throw new RuntimeException(e);\n}\n```\n### Client\n```java\ntry (Socket socket = new Socket(\"\", 8000)) {\n    FramedReader reader = new FramedReader(socket.getInputStream());\n    FramedWriter writer = new FramedWriter(new OutputStreamWriter(socket.getOutputStream()));\n    writer.writeString(\"Hello world\");\n    System.out.println(\"ECHO: \" + reader.readString());\n} catch (Exception e) {\n    throw new RuntimeException(e);\n}\n```\n\n## License\nThis projects is license under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessandro-salerno%2Fframedtcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessandro-salerno%2Fframedtcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessandro-salerno%2Fframedtcp/lists"}