Welcome to the JavaRanch.
Tucker Connelly wrote:I printed out the socket's port (I'm assuming that that's the port that the socket is writing to, as opposed to the local port which it listens on) and it was some random port (not the port that Flash is listening on). [/i]
I'm confused. Who's the client in this case? Flash?
The way TCP works, regardless of language, is a server listens to a port, let's say X. A client attempts to connect to port X. If the connection is successful, the connection on the server side will be switched to a random port so the server can continue to listen for more connections to X. This process is transparent to the client and server.
You should not be worrying about port numbers, except for that initial connection. Show us some code and we'll see if we can sort it out.