Skip to content

tcp client can't receive data #324

@Seazer-x

Description

@Seazer-x
    loop_ = uvw::loop::get_default();
    tcp_handle_ = loop_->resource<uvw::tcp_handle>();
    tcp_handle_->init();

    tcp_handle_->on<uvw::error_event>([this](const uvw::error_event &event, uvw::tcp_handle &h) {
        LOG(ERROR) << "Error: " << event.what();
    });

    tcp_handle_->on<uvw::connect_event>([this](const uvw::connect_event &, uvw::tcp_handle &h) {
        LOG(INFO) << "Successfully connected to " << lidar_info->IP;
        isConnected = true;
    });

    tcp_handle_->on<uvw::data_event>([this](const uvw::data_event &data, uvw::tcp_handle &h) {
        LOG(INFO) << "Received data: " << data.length;
        Process(data.data.get(), data.length);
    });

    tcp_handle_->connect(lidar_info->IP, stoi(lidar_info->Port));

Why can't I receive the messages sent from the server? I have successfully connected to the server.

Image

Image

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions