Using sockets

Mark Smith mark at maseurope.net
Mon Mar 14 19:08:32 EST 2005


On 14 Mar 2005, at 20:15, Kevin J wrote:

> Well I have taken a break from working on my text editor. So I decided
> to play around with the socket functions. I was trying to open a
> socket to a text game so that I could read the login page I can get it
> in to the text field and the page will show up in the field but it
> will have a little square box at the left hand side of the field on
> every line. How would I get rid of that? This is what I did to connect
> to the socket
> ....


I think the little square is an ASCII number that doesn't actually have 
a corresponding alpha numeric character. When getting data from 
different systems that have different line delimiters and such-like, 
you get this sort of thing. Probably the easiest solution would be to 
insert a loop to remove them after "put it into tVar":

on mouseUp
   open socket "theseahaven.com:5500"
   read from socket "theseahaven.com:5500" for -1
   put it into tvar
   repeat for each line L in tVar
     put char 2 to -1 of L & cr after nVar
   end repeat
   delete last char of nVar --- clear trailing cr
   put nVar in to field 1
end mouseUp	



More information about the use-livecode mailing list