Hello again.
Thanks to the folks who e-mailed me about my telnet app. Unfortunately, I'm
stuck and cannot seem to figure out what I'm doing wrong. I've tried
checking the archives but there doesn't seem to be any past articles on the
topic. I've gotten to the point where I can open a socket and connect to an
IP and port. I've got a handler that loops to read the incoming text from
the server. I know that this works because I can receive the multi-line
welcome message when I connect. Unfortunately, I cannot seem to write to the
socket at all, and eventually the connection times out (I can see this
message as well so the read is still working). I'm getting quite frustrated.
As I said, I'm new to HyperTalk/*Card programming so perhaps I have the
handlers in the wrong place or something, though I've tried them in
different objects. Here's what I have so far:

There are 2 fields, 1 called MainBody (where text from the server is
received) and 1 called TextInput (where the client inputs text to send).
There's also a button butSend which when clicked should write to socket.

In MainBody:

on ReadFromIP
  global MyIP
  read from socket MyIP until empty
  if it <> "" then
    put it after field "MainBody"
  end if
  send ReadFromIP to me in 100 milliseconds
  set the currentMessageID of me to it
end ReadFromIP

on CloseIt
  cancel (the currentMessageID of me)
  put "*** Disconnected ***" & CRLF after field "MainBody"
end CloseIt

on WriteToIP
  global MyIP
  write field "TextInput" to socket MyIP
end WriteToIP


In butSend:

on mouseUp
  send WriteToIP to field "MainBody"
  put empty into field "TextInput"
end mouseUp

in butConnect (to make the initial connection):

on mouseUp
  global MyIP
  open socket MyIP
  put empty into field "MainBody"
  send ReadFromIP to field "MainBody"
end mouseUp

Like I said, I know that I am successfully connecting and reading from the
socket, but writing seems to disappear into the ether without a trace. I
never see a response, either in the Rev client, or on the server. Please
help! Thanks in advance.

Sincerely,
Matt
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Matthew Duhan    [EMAIL PROTECTED]     http://shell2.primushost.com/~fringe
When I want my opinions I'll ask me for them.
WWW, HTML, VR, MOO, HRSFA, TMBG, DNA--any more initials and I'll go insane
Imagination is the only weapon we have in the war against reality.

Reply via email to