Results 1 to 6 of 6
  1. #1
    Omarero is offline Member
    Join Date
    Oct 2008
    Posts
    25
    Rep Power
    0

    Default socket programming

    i need to connect two different computers using net beans.
    using socket programming , i need an example how to set up a socket,server and client ??

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    10

    Default

    Java Code:
        /**
         * Creates a stream socket and connects it to the specified port
         * number on the named host.
         * <p>
         * If the specified host is <tt>null</tt> it is the equivalent of
         * specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>.
         * In other words, it is equivalent to specifying an address of the 
         * loopback interface. </p>
         * <p>
         * If the application has specified a server socket factory, that
         * factory's <code>createSocketImpl</code> method is called to create
         * the actual socket implementation. Otherwise a "plain" socket is created.
         * <p>
         * If there is a security manager, its
         * <code>checkConnect</code> method is called
         * with the host address and <code>port</code> 
         * as its arguments. This could result in a SecurityException.
         *
         * @param      host   the host name, or <code>null</code> for the loopback address.
         * @param      port   the port number.
         *
         * @exception  UnknownHostException if the IP address of 
         * the host could not be determined.
         *
         * @exception  IOException  if an I/O error occurs when creating the socket.
         * @exception  SecurityException  if a security manager exists and its  
         *             <code>checkConnect</code> method doesn't allow the operation.
         * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
         * @see        java.net.SocketImpl
         * @see        java.net.SocketImplFactory#createSocketImpl()
         * @see        SecurityManager#checkConnect
         */
        public Socket(String host, int port)
    	throws UnknownHostException, IOException
    Unpack the sources, google for sample code ( not all of which will be good code )
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    10

    Default Tutorial...

    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  4. #4
    Omarero is offline Member
    Join Date
    Oct 2008
    Posts
    25
    Rep Power
    0

    Default

    thank u so so much cjsl , that was so helpfull.

  5. #5
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    10

    Default Any time...

    You're welcome...

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  6. #6
    Omarero is offline Member
    Join Date
    Oct 2008
    Posts
    25
    Rep Power
    0

    Default

    now i succeded in connecting two computers in the same network, how can i connect them on the internet

Similar Threads

  1. Socket programming
    By ikoko in forum New To Java
    Replies: 1
    Last Post: 10-16-2008, 02:50 PM
  2. Socket programming - port issues
    By ravian in forum Networking
    Replies: 2
    Last Post: 11-07-2007, 11:24 AM
  3. Programming Socket Question
    By paul in forum Networking
    Replies: 1
    Last Post: 07-30-2007, 07:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •