Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Help with Protocol family unavailable exception.  (Read 1717 times)
0 Members and 1 Guest are viewing this topic.
Offline Epo

Senior Newbie


Projects: 1


Green Tea and swords


« Posted 2009-11-23 00:57:20 »


Hello I am a little stuck on this exception that I am getting.


I keep getting this exception on the server side, but not the client side. The client side connects with no problem.
I am trying to solve it for the Server Side for I do not get this exception any more. Any help would be appreciated.
1  
2  
3  
4  
5  
6  
7  
8  
9  
java.net.SocketException: Protocol family unavailable
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.DatagramChannelImpl.connect(Unknown Source)
        at game.server.Client.setUDPConnection(Client.java:125)
        at game.server.Client.<init>(Client.java:33)
        at server.ServerClient.<init>(ServerClient.java:24)
        at server.TankClientListener.addClient(TankClientListener.java:31)
        at game.server.ClientListener.checkNewPlayers(ClientListener.java:23)
        at game.server.GameServer.run(GameServer.java:44)



The server is running on the same machine as the client when testing.
This is suppose to be a TCP/UDP server for a game I am working on.

Works on the Client Side when the client connects but not on the Server side when the server side accepts the connection and sets up the UDP channel.

The source code that is used on the Client and Server for making the UDP connection is below.


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
==========================
Server Side==================
==========================

public boolean setUDPConnection(){
   try{
      mainChannelUDP = DatagramChannel.open();
      mainChannelUDP.connect(new InetSocketAddress(mainChannelTCP.socket().getInetAddress(),2593));
      mainChannelUDP.configureBlocking(false);
   }catch(Exception e){e.printStackTrace();return false;}
   return true;
}//END METHOD

==================================================================
Client Side==========================================================/
==================================================================

public boolean setUDPConnection(){
   try{
      mainChnlUDP = DatagramChannel.open();
      mainChnlUDP.connect(new InetSocketAddress(mainChnlTCP.socket().getInetAddress(),2593) );
      mainChnlUDP.configureBlocking(false);
   }catch(Exception e){e.printStackTrace(); return false;}
   return true;
}//END METHOD


------------------
-Java Version-
------------------
1  
2  
3  
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)


Thank you very much for the help.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (37 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (27 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!