Skip to content
Discussion options

You must be logged in to vote

Trying to send an image over a 50 metre path and when it fails to connect

I am pretty sure you are mixing 2-3 mostly unrelated things here.

  • given the target host/port is listening, and we are talking about TCP here, connect() should not fail.
  • a failed connect() call should not cause a reboot.
  • in your code, you poll for POLLIN.
    Depending upon the protocol used (if any), this might never return anything else than false (the empty tuple).
    I would poll for POLLOUT, as you want to send data over the link.
    In my opinion, after connect() succeeds, a check using poll() is useless, anyway. Just write() your data. You need poll() if you want to avoid blocking write() and read() calls, of course.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@davefes
Comment options

Answer selected by davefes
Comment options

You must be logged in to vote
1 reply
@karfas
Comment options

Comment options

You must be logged in to vote
1 reply
@karfas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment