@OvermindDL1 I just added packet: :line
on a whim to see if that would fix my issue and it did not – I see the same behavior when I take it out and have just opts = [:binary, active: false]
I have confirmed that there is a newline at the end of the number that is returned, though.
@NobbZ I did watch tcpdump
but I’ll have to become much more expert with it to really understand what I’m looking at.
In brief, though: VowpalWabbex.start_link
results in this tcpdump
output:
17:42 IP 172.16.17.35.52949 > 10.247.4.104.26542: Flags [S], seq 2103055949, win 65535, options [mss 1360,nop,wscale 5,nop,nop,TS val 237205327 ecr 0,sackOK,eol], length 0
17:42 IP 10.247.4.104.26542 > 172.16.17.35.52949: Flags [S.], seq 857525256, ack 2103055950, win 28960, options [mss 1379,sackOK,TS val 1819819275 ecr 237205327,nop,wscale 9], length 0
17:42 IP 172.16.17.35.52949 > 10.247.4.104.26542: Flags [.], ack 1, win 4128, options [nop,nop,TS val 237205434 ecr 1819819275], length 0
To me that looks like a handshake – three message: first from me to him, second an “ack” from him to me, and then third an “ack” from me to him.
After I try to make the send/2
call, tcpdump
shows:
17:44 IP 172.16.17.35.52949 > 10.247.4.104.26542: Flags [P.], seq 1:14, ack 1, win 4128, options [nop,nop,TS val 237323302 ecr 1819819275], length 13
17:44 IP 10.247.4.104.26542 > 172.16.17.35.52949: Flags [.], ack 14, win 57, options [nop,nop,TS val 1819848826 ecr 237323302], length 0
I don’t see my actual data there, but the length 13
in the first line is correct, since I’m sending |c country_US
which has exactly 13 length.
However, when I observer tcpdump
for echo "|c country_US" | nc 10.247.4.104 26542
, I get this output:
18:04 IP 172.16.17.35.53085 > 10.247.4.104.26542: Flags [S], seq 1747162267, win 65535, options [mss 1360,nop,wscale 5,nop,nop,TS val 238489788 ecr 0,sackOK,eol], length 0
18:04 IP 10.247.4.104.26542 > 172.16.17.35.53085: Flags [S.], seq 3797483678, ack 1747162268, win 28960, options [mss 1379,sackOK,TS val 1820141152 ecr 238489788,nop,wscale 9], length 0
18:04 IP 172.16.17.35.53085 > 10.247.4.104.26542: Flags [.], ack 1, win 4128, options [nop,nop,TS val 238489900 ecr 1820141152], length 0
18:04 IP 172.16.17.35.53085 > 10.247.4.104.26542: Flags [P.], seq 1:15, ack 1, win 4128, options [nop,nop,TS val 238489900 ecr 1820141152], length 14
18:04 IP 172.16.17.35.53085 > 10.247.4.104.26542: Flags [F.], seq 15, ack 1, win 4128, options [nop,nop,TS val 238489900 ecr 1820141152], length 0
18:04 IP 10.247.4.104.26542 > 172.16.17.35.53085: Flags [.], ack 15, win 57, options [nop,nop,TS val 1820141179 ecr 238489900], length 0
18:04 IP 10.247.4.104.26542 > 172.16.17.35.53085: Flags [F.], seq 10, ack 16, win 57, options [nop,nop,TS val 1820141179 ecr 238489900], length 0
18:04 IP 172.16.17.35.53085 > 10.247.4.104.26542: Flags [.], ack 1, win 4128, options [nop,nop,TS val 238490007 ecr 1820141179,nop,nop,sack 1 {10:11}], length 0
18:04 IP 10.247.4.104.26542 > 172.16.17.35.53085: Flags [P.], seq 1:10, ack 16, win 57, options [nop,nop,TS val 1820141179 ecr 238489900], length 9
18:04 IP 172.16.17.35.53085 > 10.247.4.104.26542: Flags [.], ack 11, win 4127, options [nop,nop,TS val 238490007 ecr 1820141179], length 0
One difference I see is that length 14 is sent from netcat, while length 13 is sent from Elixir – maybe I should send a newline at the end as well?
Finally, would you recommend I use https://github.com/meh/elixir-socket in order to abstract away some of the low-level stuff?