Writing in a socket trough TCL problem.

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Writing in a socket trough TCL problem.
# 1  
Old 09-10-2009
Writing in a socket trough TCL problem.

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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Problem with TCL package

Following error encountered while executing characterizationEngine.tcl :confused::confused: $ ./characterizationEngine.tcl Tcl Client is running Ixia Software version: 5.60 Can't find tclx.tcl in the following directories: /usr/lib/tclX8.3 /usr/lib/tclX8.3 /usr/lib/tclX8.3... (0 Replies)
Discussion started by: hiten.r.chauhan
0 Replies

2. IP Networking

Writing a Socket Server

Hi All I have to design a server socket program.The requirement is Each connection from client will be in different threads. The challenge is Suppose Server is now connected with two client Client A and client B.They will be in two different thread. My application requirement is when... (4 Replies)
Discussion started by: mr_deb
4 Replies

3. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

4. Shell Programming and Scripting

tcl problem

I'm trying to write a script that will do the following: Open a text file for reading/writing. Read each line. When I find a specfic value in a line, append something to the end of that line. I loop through and read all the lines in myfile.txt looking for dev123_data_log and find a... (5 Replies)
Discussion started by: progkcp
5 Replies

5. Programming

Tcl - SOAP Problem

Hi, Im working with client side Tcl implementation on unix box of web services, to login to a tool with web service method written in C# on windows box and it is accessed by its link from the browser on unix box. Sorry that i have hidden the original names for security reasons. Using... (0 Replies)
Discussion started by: SankarV
0 Replies

6. UNIX for Dummies Questions & Answers

problem with tk_optionmenu in tcl/tk

hi how can i see all and select one option from tk_optionMenu in tcl/tk using keyboard only. Thanks (0 Replies)
Discussion started by: pankajbgarh
0 Replies

7. Programming

socket communication but not writing

hello, when i execute my code server side it connects with the client and when i try to write through the server into the client the program exits. i could not understand whether it is the problem with the server or with the client.The Protocol is TCP/IP. thanking you. (2 Replies)
Discussion started by: madfox
2 Replies

8. Shell Programming and Scripting

TCL Socket max Limit settting

How to set the max limit for socket opening TCL Thanks, Ajay (1 Reply)
Discussion started by: aju_kup
1 Replies

9. HP-UX

Problem in HP-Unix while writing into socket

Our system is having a server and multiple clients. We are monitoring the client FDs using select() system call in HP-UX. After establishing connection-using socket with the remote client, before start sending the data we are checking the status of socket using select( ) call. For first 16... (0 Replies)
Discussion started by: AshokG
0 Replies
Login or Register to Ask a Question