{"id":13589346,"url":"https://github.com/CodeSpartan/UE4TcpSocketPlugin","last_synced_at":"2025-04-08T09:32:35.133Z","repository":{"id":47415047,"uuid":"181501414","full_name":"CodeSpartan/UE4TcpSocketPlugin","owner":"CodeSpartan","description":"Tcp Socket Plugin facilitates communication with a TCP server in blueprints or in code.","archived":false,"fork":false,"pushed_at":"2024-04-25T16:51:26.000Z","size":658,"stargazers_count":247,"open_issues_count":0,"forks_count":72,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-02T16:31:06.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/CodeSpartan.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}},"created_at":"2019-04-15T14:14:07.000Z","updated_at":"2024-07-23T04:50:20.000Z","dependencies_parsed_at":"2024-01-16T21:53:01.657Z","dependency_job_id":null,"html_url":"https://github.com/CodeSpartan/UE4TcpSocketPlugin","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/CodeSpartan%2FUE4TcpSocketPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSpartan%2FUE4TcpSocketPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSpartan%2FUE4TcpSocketPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSpartan%2FUE4TcpSocketPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeSpartan","download_url":"https://codeload.github.com/CodeSpartan/UE4TcpSocketPlugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223314086,"owners_count":17124999,"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-08-01T16:00:28.530Z","updated_at":"2024-11-06T09:30:50.735Z","avatar_url":"https://github.com/CodeSpartan.png","language":"C++","funding_links":[],"categories":["Networking","C++"],"sub_categories":[],"readme":"# UE4 TCP Socket Plugin\nTcp Socket Plugin for Unreal Engine 4 facilitates communication with a TCP server purely in blueprints. Client-only functionality. Built version can be downloaded [here](https://unrealengine.com/marketplace/en-US/product/tcp-socket-plugin).\n\n# List of Features\n- Multiple connections\n- Multi-threading: each connection runs on its own thread\n- Detects disconnects as soon as they happen\n- Event dispatchers: OnConnected, OnDisconnected (also triggers when connection fails), OnMessageReceived\n- Serialize and deserialize basic types: UInt8, Int32, Int64, Float (4 and 8 bytes), String\n- Free and open source under MIT license\n\n# Usage in Blueprints\nCreate a blueprint actor inheriting from TcpSocketConnection, drop it into level and use these nodes:\n![Alt text](/functionality.jpg?raw=true \"Functionality\")\n\n# Usage in C++\nThis is only an example.\nIn .h\n```cpp\nUCLASS()\nclass EXAMPLE_API ACppSocketConnection : public ATcpSocketConnection\n{\n\tGENERATED_BODY()\n public:\n\tUFUNCTION()\n\tvoid OnConnected(int32 ConnectionId);\n\n\tUFUNCTION()\n\tvoid OnDisconnected(int32 ConId);\n\n\tUFUNCTION()\n\tvoid OnMessageReceived(int32 ConId, TArray\u003cuint8\u003e\u0026 Message);\n  \n  \tUFUNCTION(BlueprintCallable)\n\tvoid ConnectToGameServer();\n\t\n\tUPROPERTY()\n\tint32 connectionIdGameServer;\n}\n```\n\nIn .cpp\n```cpp\nvoid ACppSocketConnection::ConnectToGameServer() {\n\tif (isConnected(connectionIdGameServer))\n\t{\n\t\tUE_LOG(LogError, Log, TEXT(\"Log: Can't connect SECOND time. We're already connected!\"));\n\t\treturn;\n\t}\n\tFTcpSocketDisconnectDelegate disconnectDelegate;\n\tdisconnectDelegate.BindDynamic(this, \u0026ACppSocketConnection::OnDisconnected);\n\tFTcpSocketConnectDelegate connectDelegate;\n\tconnectDelegate.BindDynamic(this, \u0026ACppSocketConnection::OnConnected);\n\tFTcpSocketReceivedMessageDelegate receivedDelegate;\n\treceivedDelegate.BindDynamic(this, \u0026ACppSocketConnection::OnMessageReceived);\n\tConnect(\"127.0.0.1\", 3500, disconnectDelegate, connectDelegate, receivedDelegate, connectionIdGameServer);\n}\n\nvoid ACppSocketConnection::OnConnected(int32 ConId) {\n\tUE_LOG(LogTemp, Log, TEXT(\"Log: Connected to server.\"));\n}\n\nvoid ACppSocketConnection::OnDisconnected(int32 ConId) {\n\tUE_LOG(LogTemp, Log, TEXT(\"Log: OnDisconnected.\"));\n}\n\nvoid ACppSocketConnection::OnMessageReceived(int32 ConId, TArray\u003cuint8\u003e\u0026 Message) {\n\tUE_LOG(LogTemp, Log, TEXT(\"Log: Received message.\"));\n  \t// In this example, we always encode messages a certain way:\n  \t// The first 4 bytes contain the length of the rest of the message.\n  \twhile (Message.Num() != 0) {\n\t\t// read expected length\n\t\tint32 msgLength = Message_ReadInt(Message);\n\t\tif (msgLength == -1) // when we can't read 4 bytes, the method returns -1\n\t\t\treturn;\n\t\tTArray\u003cuint8\u003e yourMessage;\n\t\t// read the message itself\n\t\tif (!Message_ReadBytes(msgLength, Message, yourMessage)) {\n\t\t\t// If it couldn't read expected number of bytes, something went wrong.\n\t\t\t// Print a UE_LOG here, while your project is in development.\n\t\t\tcontinue;\n\t\t}\n\t\t// If the message was read, then treat \"yourMessage\" here!\n\t\t// ...\n\t\t// And then we go back to the \"while\", because we may have received multiple messages in a frame, \n\t\t// so they all have to be read.\n  \t}\n}\n```\n\n# Platforms\nIntended for all platforms that support sockets and multithreading, which is most of them, except HTML5. \u003cbr /\u003e\nTested on platforms: Windows\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCodeSpartan%2FUE4TcpSocketPlugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCodeSpartan%2FUE4TcpSocketPlugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCodeSpartan%2FUE4TcpSocketPlugin/lists"}