You are absolutely right, thank you so much.
On Saturday, December 20, 2014 7:01:10 PM UTC-5, Jameson wrote: > > it looks to me like the return value of roll (meaning 8 bytes were written > to the socket on that last call to write) > > On Sat Dec 20 2014 at 6:28:31 PM Micah McClimans <[email protected] > <javascript:>> wrote: > >> This is a clone of a question on Stackoverflow (original here: >> http://stackoverflow.com/questions/27585013/extra-data-on-socket-communication-in-julia >> >> ) >> >> I'm working on getting a grip on socket programming in Julia, and I'm >> getting, what seems to me at least, a really weird bug. This is my testing >> program: >> >> function startServer(port::Integer) >> server=listen(port) >> while true >> sock=accept(server) >> @async while true >> sig=read(sock,Int64) >> if sig==0 >> write(sock,rand(Int64)) >> elseif sig==1 >> raw=read(sock,Int64) >> write(sock,raw+1) >> end >> end >> end >> end >> >> function dumbwrite(connection) >> while true >> kappa=read(connection,Int64) >> println(STDOUT,kappa) >> end >> end >> >> function roll(port::Integer) >> @spawn startServer(port) >> clientside=connect(port) >> @spawn dumbwrite(clientside) >> >> write(clientside,0) >> write(clientside,0) >> write(clientside,1) >> write(clientside,56) >> write(clientside,1) >> write(clientside,34) >> write(clientside,1) >> write(clientside,34) >> write(clientside,0) >> write(clientside,0) >> write(clientside,0) >> write(clientside,0) >> write(clientside,0) >> write(clientside,0) >> end >> >> >> The output this generates looks like this: >> >> julia> roll(9884) >> 8104588522876597874 >> -8585609018870996947 >> 57 >> 35 >> 35 >> -2674324649969450471 >> -7370669957356464799 >> 6388910330871895635 >> -4817888634766788568 >> -4381550835994661230 >> 8 >> -8151987627137122115 >> >> Where is that 8 coming from? No matter how many extra copies of >> `write(clientside,0)` I put in there, there is always an 8 output in the >> second to last line, and I have no clue where it is coming from. Any help >> would be great. >> >
