
Retreiving data from Java server through WinSock COM object
Hi,
I'm trying to pick up a list of available rooms on my chat server (NFC Java
Chat Server) from an ASP page. To acheive this I'm emulating a chat client
through a WinSock DLL (Dimac's W3 Sockets). This seems to be working and I
can successfully log in & out from the server (confirmed by monitoring the
server) but I'm having trouble picking up the return messages from the
server. The code I'm using is:
----------------------------------------------------
Set socket = Server.CreateObject("Socket.TCP")
Function getRooms(strServer,strUser,strPass)
socket.Host = strServer
socket.Open()
socket.SendLine("<message value=""/signon " & strUser & " " & strPass & "
/>")
socket.SendLine("<message value=""/rooms />")
socket.SendLine("<message value=""/quit />")
socket.WaitForDisconnect()
getRooms = ("<blockquote><pre>" + socket.Buffer + "</pre></blockquote>")
socket.Close()
End Function
Response.Write(getRooms(" [server ip & port] "," [username] "," [password]
"))
----------------------------------------------------
This executes without error but the buffer is always empty. I've also tried
using socket.GetLine() and socket.GetText(4) but then the function hangs,
apparently waiting for input, and eventually times out. What am I doing
wrong here? I have the source code for a Flash client that works with the
server and from looking at the debug output I can see the following messages
being sent/received when a user logs in:
Sending: <message value="/signon FOOUSER foopass" />
Received: <message value="/ack_signon FOOUSER" />
Sending: <message value="/rooms" />
Sending: <message value="/users" />
Received: <message value="Welcome to NFC 1.0" />
Received: <message value="/rooms Room1" />
Received: <message value="/users FOOUSER" />
As you can see this is in XML but that shouldn't affect things. I mean it's
still just strings of text and I should be able to send/receive them from
any socket client, right? Does anyone out there have any experience of a
similar scenario? Any help greatly appreciated!
Ola Tuvesson