Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unrecognized Windows Sockets Error: 0: JVM_Bind

795507Apr 6 2010 — edited May 18 2013
I'm not entirely sure if I compacted this well enough, but after class declaration and method calling, it is essentially what my program does.
Server server = new Server(); // Creates a ServerSocket and binds it to a port.
Client client = new Client(server.getSocketAddress());
 
public Client(SocketAddress bind)
{
	try
	{
		socket = new Socket();
		socket.bind(bind); // Problem here
		recieve = new Scanner(socket.getInputStream());
		send = new Formatter(socket.getOutputStream());
	}
	catch (IOException e)
	{
		e.printStackTrace();
	}
}
Running the above code produces the following exception.
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.PlainSocketImpl.bind(Unknown Source)
	at java.net.Socket.bind(Unknown Source)
	at GameObjects.PlayArea$Client.<init>(PlayArea.java:318)
	at GameObjects.PlayArea.<init>(PlayArea.java:48)
	at MenuStates.GamePlayState.initializePlayArea(GamePlayState.java:90)
	at MenuStates.CreateGameState.mouseClicked(CreateGameState.java:106)
	at Manager.GameManager.mouseClicked(GameManager.java:428)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Window.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
I don't even know what this exception is, and I can't find anything that will really tell me what is going on. Can anyone tell me what is happening here?

I know that this question isn't directly related to Game Development, but I am using it in a game program, and I posted this question in the Network forum, and they flooded my topic with useless messages, and the only person who actually answered my question was extremely vague about it, even after I asked him to clarify. I am hoping that the good people of this forum will be more helpful.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2013
Added on Apr 6 2010
5 comments
16,817 views