Array of Sockets Java

前端 未结 4 723
心在旅途
心在旅途 2021-01-15 13:37

I\'m creating server and client java applications. I would like to create an array to store my sockets in. I\'m using eclipse, and when I type in this line:

         


        
4条回答
  •  花落未央
    2021-01-15 14:01

    You can outsmart this problem easily, just create a class containing a socket connection, then build an array of this class object.

    Build the class:

    Class example { Socket con;

    The constructor and extra code here ...

    }

    Then just build the array:

    example[] arr=new example[3];

提交回复
热议问题