Results 1 to 4 of 4
  1. #1
    Blacknight962 is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Default ..........

    ..........
    Last edited by Blacknight962; 05-07-2010 at 10:07 AM.

  2. #2
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    Why do you have a server socket if this is the client?

    Also, what output do you get? What server are you connecting to. Maybe the server just isn't sending anything.

  3. #3
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    Sorry, I misread your code as well.

    However, knowing which client your connecting to, and the output would still be useful.

    Does the client and server actually connect?

    Mr. Beans

  4. #4
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    Try using this to test your server

    Java Code:
    import java.io.*;
    import java.net.*;
    import java.util.Scanner;
    
    public class Client {
        public static void main(String[] args) throws IOException {
    
            Socket clientSocket = null;
            PrintWriter out = null;
            Scanner in = new Scanner(System.in);
    
            try {
                clientSocket = new Socket("????", 43595);
                out = new PrintWriter(clientSocket.getOutputStream(), true);
            } catch (UnknownHostException e) {
                System.err.println("Don't know about host: taranis.");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for "
                                   + "the connection to: taranis.");
                System.exit(1);
            }
    
    	String userInput;
    
    	while ( !( userInput = in.nextLine() ).equals( "/quit" ) ) {
    	    out.write(userInput);
    	}
    
    	out.close();
    	in.close();
    	in.close();
    	clientSocket.close();
        }
    }
    Just change "????" to tell the socket where to look for your server.


    Mr. Beans

Similar Threads

  1. Sockets NIO
    By aamp in forum New To Java
    Replies: 3
    Last Post: 01-15-2009, 11:56 AM
  2. Threads + Sockets
    By Tomdarkness in forum New To Java
    Replies: 1
    Last Post: 12-24-2008, 01:06 AM
  3. Java application using sockets!
    By rameshraj in forum Threads and Synchronization
    Replies: 1
    Last Post: 06-11-2008, 07:13 PM
  4. Sockets
    By Zosden in forum Networking
    Replies: 16
    Last Post: 05-27-2008, 05:55 PM
  5. Help with Sockets
    By Eric in forum Networking
    Replies: 3
    Last Post: 12-01-2007, 09:09 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
  •