Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Java TCP Sockets

Name: Anonymous 2012-10-30 8:55

EXPLAIN TO ME THIS WIZARDRY;

I have a Java server handling 3 TCP ServerSockets.

I have a client that connects to 1, hereby getting transferred a hashmap containing the info (protocol, port) to connect to the other 2 (game and chat server)

The clients closes the first connection and creates 1 to the game server, one to the chat server.
The client then sends a message trying to see if he's at the correct one, and should receive a code to confirm he's connected.

HOWEVER. For whatever random as fuck reason, when I send a package to the ChatServer at port 4462, the serverSocket at 4461 receives it, and the message sent to 4461 (gameServer) is NOWHERE TO BE FUCKING FOUND.

I get a different result every time I reboot the client. Either the package sent to the request server gets received by the gameserver, or the package sent to chatserver gets received by the gameserver.


CLIENT

TCPCommunicator: chat: connected to localhost:4462
TCPCommunicator: chat: Sending 302 to localhost/127.0.0.1:4462


SERVER

DataResponder - New TCP client at 0.0.0.0/0.0.0.0
DataResponder waiting for new connections at port 4461
>>> TCPConnectedClient: DataResponder waiting for packets
Dataresponder received 302

WHYYYYYYYYYYYYYY.

Name: Anonymous 2012-10-30 10:12

Your high level design is atrocious. If you're establishing more than one TCP connection to the same host for the same application, you're doing it wrong.

Name: OP 2012-10-30 10:23

It's required, though.

Both game & chatservers can be changed to either TCP/UDP whenever, and they should (preferably) be seperate.

I could check if they're both set to TCP and get them over the same socket, but still wouldn't explain why this doesn't work. "You're doing it wrong" is not a valid compile error.

Name: Anonymous 2012-10-30 10:29

are you using a socket factory?

Name: Anonymous 2012-10-30 10:35

Oh, so it's homework.

Name: Anonymous 2012-10-30 11:00

It's my networking project required for bachelor, yes. I'm sorry if your vague remarks aren't worth being spouted over that.
I'll take a look at socketfactory - cheers.

Name: Anonymous 2012-10-30 11:37

Anon, I love you. Upon implementing ServerSocketFactory everything is going smooth as silk.

You have my thanks.

Name: Anonymous 2012-10-30 11:56

>>7
Typical Java programmer.

Don't change these.
Name: Email:
Entire Thread Thread List