PDA

View Full Version : Using socket connections


forcedfx
01-25-2007, 01:31 PM
I'm working on a program that connects to my server and sends and receives data back and forth. The server program is written in VB6 using Winsock.

When I simulate it, the connection is established and I can receive data from the server program. But when I try to send data nothing is going to the server program.

This is what I have for code, am I doing something wrong?


try
{

conn = (StreamConnection)Connector.open(URL);

_out = new outputStreamWriter(conn.openOutputStream());
String outData = "ack"
int length = outData.length();
_out.write(outData, 0, length);
conn.close();
_continue=false;

}

forcedfx
01-25-2007, 01:35 PM
Oh duh, n/m I added _out.flush(); after sending the data and it went through. Maybe it's a quirk with Winsock?

bemshaswing
01-26-2007, 09:18 AM
Oh duh, n/m I added _out.flush(); after sending the data and it went through. Maybe it's a quirk with Winsock?

I *believe* that's more of a quirk of the stream writer than it is winsock, I've hit this in other projects