Hello everyone:
I have a script that writes and read DATA in/from a socket, but i have a great problem while writing.
My socket is created in this way:
set connection [socket -async $server $main_port]
fconfigure $connection -encoding binary -translation binary -blocking 1
And the writer procedure is this one:
proc p_send_data { DATA } {
global connection
puts -nonewline $connection $DATA
flush $connection
}
This works, except when i call "p_send_data" many times and quickly (pej: while {1} {p_send_data "ksdjfksdf"}).
If my socket is in "blocking mode" , where is the problem??!! socket must remain blocked until it becomes writable, shouldn't it?
And tracing with "tcpdump" , "puts" command only works first and second time is called, after that, "puts" command is executed but it doesn't write anything in socket.
I have try also with my socket in "nonblocking mode" and writing in this way
fileevent $connection writable [puts $connection $DATA; flush $connection]
But the result is the same, the program "executes" all "puts" and "flush" instructions but there is not any trace with tcpdump .
PD sorry for my english.