cuongnv-ict / TCPSocket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TCPSocket

Original project:
https://github.com/stubma/cocos2dx-better
Updates:
- Port into cocos2dx v3 - Remove some dependencies (this part can work individually) - thread safe
Example:
   std::string s = "simple_string";
    
    auto mainHub = funny::network::TCPSocketHub::create();
    mainHub->setRawPolicy(true);
    mainHub->retain();
    
    auto socket = mainHub->createSocket("your ip here", 6869, 11);
    
    auto packet = new funny::network::Packet();
    packet->initWithRawBuf(s.c_str(), s.length(), -1);
    
    socket->sendPacket(packet);
    
    packet->release();
Test server
get server in /server/socketserver.py and run it in your local host to test connection. ``` shell python socketserver.py ```
Dependencies
- JSONUtils: https://github.com/kudo108/CCJsonUtils
Contacts:
If you have any question, feel free to ask me, I will help you! - Skype: kudo_108 - Email: quan.nguyenvan000@gmail.com

About

License:MIT License


Languages

Language:C++ 97.5%Language:Python 2.5%