Socket Help "Socket Newbie" 
Author Message
 Socket Help "Socket Newbie"

Ok I keep getting this error after I send so much stuff through a socket
connect I made.  "Error: couldn't open socket: no buffer space
avaiable"  I have no idea what is happening here.  I am new to sockets.
But It looks as if it is storing everything I am sending in a buffer of
some kind even though the data is recieved on the other side of the
connect.  It just will stop sending and have that error after so much
data has gone through.  Any help to solve this promblem would be greatly
Appreciated.

Thanks,
            Brady



Mon, 30 Jun 2003 05:03:18 GMT  
 Socket Help "Socket Newbie"
Here is the code that seems to be having a problem.  I really can't seen
anything wrong with it though.  Maybe if someone else looks at it besides me
they can see the error.

###############################
pack [text .t ]

proc {bozo} {args} {
scan $args "%s%s%s" idsock add port
set bobo [gets $idsock]
set tyt [fconfigure $idsock -peername]
scan $tyt "%s%s%s" ipp addd pott
.t insert end "$ipp - $pott - $bobo\n"

Quote:
}

set sockId 0
set sockId [socket -server bozo 8888]
vwait sockId
###############################
Quote:

> Ok I keep getting this error after I send so much stuff through a socket
> connect I made.  "Error: couldn't open socket: no buffer space
> avaiable"  I have no idea what is happening here.  I am new to sockets.
> But It looks as if it is storing everything I am sending in a buffer of
> some kind even though the data is recieved on the other side of the
> connect.  It just will stop sending and have that error after so much
> data has gone through.  Any help to solve this promblem would be greatly
> Appreciated.

> Thanks,
>             Brady



Mon, 30 Jun 2003 18:42:08 GMT  
 Socket Help "Socket Newbie"
You are only reading one line from your socket

your bozo proc only gets called when a new connection is received
on the server socket & it creates a new socket (which you get in the bozo proc)
you read one line and then exit (at which point you lose a reference to the new socket name).

what you need to do is create a fileevent procedure on the new socket and do the read
in that proc which will keep getting called any time there is something to read on the socket.

e.g.

proc  newConnection {newSock addr port} {
    set dat [fconfigure $newSock -peername]
    fileevent $newSock readable [list readSomeData $newSock [lindex $dat 0] [lindex $dat 1] [lindex $dat 2] ]

Quote:
}

proc readSomeData {sock addr host port} {
    set data [gets $sock]
    .t insert end "$addr - $host - $port : $data"

Quote:
}

of course, you will need to check for eof or other errors & close out gracefully,
but this should keep reading the data as long as there is some

Hope it helps,.
  Bruce

Quote:

> Here is the code that seems to be having a problem.  I really can't seen
> anything wrong with it though.  Maybe if someone else looks at it besides me
> they can see the error.

> ###############################
> pack [text .t ]

> proc {bozo} {args} {
> scan $args "%s%s%s" idsock add port
> set bobo [gets $idsock]
> set tyt [fconfigure $idsock -peername]
> scan $tyt "%s%s%s" ipp addd pott
> .t insert end "$ipp - $pott - $bobo\n"
> }

> set sockId 0
> set sockId [socket -server bozo 8888]
> vwait sockId
> ###############################


> > Ok I keep getting this error after I send so much stuff through a socket
> > connect I made.  "Error: couldn't open socket: no buffer space
> > avaiable"  I have no idea what is happening here.  I am new to sockets.
> > But It looks as if it is storing everything I am sending in a buffer of
> > some kind even though the data is recieved on the other side of the
> > connect.  It just will stop sending and have that error after so much
> > data has gone through.  Any help to solve this promblem would be greatly
> > Appreciated.

> > Thanks,
> >             Brady



Tue, 01 Jul 2003 07:22:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with "socket -server" needed

2. Error: "Remote Socket closed"

3. "timingOut in smalltalk sockets ..SOS"

4. VWNC30 Socket "Sleeper" Problem solved

5. "Quene" for socket connections

6. "bad file descriptor" from tcp sockets

7. Gnat.Sockets.Stream memory "leak"

8. Windows "C" vs TCL sockets

9. "Pesky" Carriage Return With Serial Socket

10. Sockets stuck in "CLOSE" state

11. Q about "socket -server"

12. HELP - I'm a "newbie"

 

 
Powered by phpBB® Forum Software