getting error as "**read would block**" while reading from socket. #608
-
I am trying to implement AWS Secure tunnel in my application. I am able to create and connect to tunnel. I need some help or suggestions. Thank you in advance int TcpForward::Connect()
{
aws_socket_endpoint endpoint{};
std::string localhost = "127.0.0.1";
snprintf(endpoint.address, AWS_ADDRESS_MAX_LEN, "%s", localhost.c_str());
endpoint.port = mPort;
aws_event_loop *eventLoop = aws_event_loop_group_get_next_loop(getEventLoop()->GetUnderlyingHandle());
aws_socket_connect(&mSocket, &endpoint, eventLoop, sOnConnectionResult, this);
return 0;
}
int TcpForward::SendData(const Aws::Crt::ByteCursor &data){
if (!mConnected)
{
aws_byte_buf_append_dynamic(&mSendBuffer, &data);
return 0;
}
auto ret1 = aws_socket_write(&mSocket, &data, sOnWriteCompleted, this);
if(AWS_OP_SUCCESS != ret1){
// Getting Error here
}
auto ret = aws_socket_get_error(&mSocket);
return 0;
} aws-iot-device-sdk-cpp-v2(v1.21.0)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Have you tried taking a look at out secure_tunnel sample? You also might want to take a look at the documentation for secure tunnels here. |
Beta Was this translation helpful? Give feedback.
-
As it stands, the socket snippets above aren't directly related to secure tunnels. If I had to speculate I'm guessing maybe you have a tunnel established in another process (or the current one) and are then port forwarding from localhost::m_port to the tunnel? If that guess is correct, then the log is from the local secure tunnel process? More details on the exact relationship between all the actors in what you're doing would be helpful (otherwise we have to speculate like above which is error prone). Some additional commentary:
|
Beta Was this translation helpful? Give feedback.
As it stands, the socket snippets above aren't directly related to secure tunnels. If I had to speculate I'm guessing maybe you have a tunnel established in another process (or the current one) and are then port forwarding from localhost::m_port to the tunnel? If that guess is correct, then the log is from the local secure tunnel process?
More details on the exact relationship between all the actors in what you're doing would be helpful (otherwise we have to speculate like above which is error prone).
Some additional commentary: