Simple client host program

I have 3 classes:
- A server
- A client
- A program which start a new server and a new client in seperate threads.
I'm wondering why the client doesn't receive messages like "message", "hello", "knock knock".
I'm also wondering whether the threads correctly terminate and whether my code is safe.
import java.io.IOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Server {
     public Server() throws IOException {
          ServerSocket server = new ServerSocket(4321);
          System.out.println("Server created");
          Socket client = server.accept();
          System.out.println("Server: connected to " + client);
          Scanner in =  new Scanner(client.getInputStream());
          PrintWriter out = new PrintWriter(client.getOutputStream());
          while(true) {
               System.out.println("sending messages");
               out.println("message");
               out.println("hello");
               out.println("knock knock");
               out.println("I love you");
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
public class TestClient {
     public TestClient() throws IOException {
          Scanner stdIn = new Scanner(System.in);
          Socket socket = new Socket("127.0.0.1", 4321); //
          System.out.println("Client created");
          Scanner in = new Scanner(socket.getInputStream());
          PrintWriter out = new PrintWriter(socket.getOutputStream());
          System.out.println("ready for input:");
          while (true) {
               System.out.println("Enter exit to exit");
               String message = stdIn.next();
               if (message.equals("exit"))
                    break;
               System.out.println("Client receives: " + in.nextLine());
          out.close();
          in.close();
          socket.close();
          System.out.println("Client: is closed");
mport java.io.IOException;
public class Runner {
     public static void main(String[] args) throws IOException{
          (new Thread() {
               @Override
               public void run() {
                    try {
                         new Server();
                    } catch (IOException e) {
                         System.err.println(e);
          }).start();
          (new Thread() {
               @Override
               public void run() {
                    try {
                         new TestClient();;
                    } catch (IOException e) {
                         System.err.println(e);
          }).start();
          System.out.println("Runner is done.");
}It's current output says:
Runner is done.
Client created
java.net.SocketException: Unrecognized Windows Sockets error: 2: JVM_Bind
ready for input:
Exception in thread "Thread-1" java.util.NoSuchElementException
     at java.util.Scanner.throwFor(Unknown Source)
     at java.util.Scanner.next(Unknown Source)
     at TestClient.<init>(TestClient.java:21)
     at Runner$2.run(Runner.java:21)

Somelauw wrote:
tschodt wrote:
Somelauw wrote:
If you want to use a PrintWriter, at least check for errors.I would rather get an exception raised giving me some information then a boolean telling me that there is something wrong.So don't use a PrintWriter.What should I use instead? I do want high-level stuff like println.You could use
BufferedWriter
[write(String)|http://java.sun.com/javase/6/docs/api/java/io/Writer.html#write%28java.lang.String%29]
[newLine()|http://java.sun.com/javase/6/docs/api/java/io/BufferedWriter.html#newLine%28%29]
>>
I guess you think my client needs to rest for 99 milliseconds every cycle.I put that in after testing your code and noticing that the client telling me
"Enter exit to exit"
was scrolling up out of view by the server telling me
"sending messages".If I comment out that line my code works.When using the code I suggested in [reply #1|http://forums.sun.com/thread.jspa?messageID=10891212#10891212] it becomes evident that the server goes though umpteen iterations of sending messages to the client.
>>
With that delay the last text on the screen is the client prompt.
Should my server rest too?What do you think?I don't see a problem, but your question suggests I shouldn't.Was that an answer? If so, can you clarify
as it is not clear what you think.

Similar Messages

  • Simple client - proxy - server toy program

    Hi.
    I haven't done many cs courses yet, lately i am reading on some introduction to network programming, and i thought i should create a simple toy program to test a bit.
    Essentially i'd like to keep the communication between client and server using bytes, so i'll but input/output streams. At the same time, i'd like to have the proxy and server and client hosted on the same pc. So, i'll be using local IP's like 127.xx.xx.xx
    Client part:
    1. open a socket to connect to proxy
    2. get input and output streams
    3. use loop to write random data to output stream, and read feedbacks from inputstream.
    Proxy Part
    1. opens a server soc to listen to client
    2. opens a soc to connect to server
    3. create 2 service objects to take care of IO, one for upstream(to server) and other for downstream
    4. display and verify content.
    Server Part:
    1. open a server socket to listen to connections
    2. create a service object to take care of stream IO
    3. display IO streams to counter verify with client IO
    Questions:
    1. When constructing a socket for client side, i should be including proxy IP and proxy listened_port as parameters right?
    if I try to put in a local ip such as 127.99.99.99, and port number 5999. At the same time i set my proxy port_to_listen_to as 5999
    how will I know which address represents my proxy?
    Will any random local IP work?
    Will a thread be more appropriate since i am using threads in proxy and server?
    2. My understanding of proxy is that it is partly a server, and partly a client. But i am not sure if i am right to create 2 threads to handle upstream and downstream operations independently. I have tried to stay out of global/static variable so that i can avoid synchronization part.
    3. As for the server side. i have similar issues regarding the IP address problems mentioned above.
    Can some one help me sort out my concepts?

    1. When constructing a socket for client side, i should be including proxy IP and proxy listened_port as parameters right?Yes.
    if I try to put in a local ip such as 127.99.99.99, and port number 5999. At the same time i set my proxy port_to_listen_to as 5999
    how will I know which address represents my proxy?That address represents your proxy.
    Will any random local IP work?127.0.0.* will work. I don' t know about the others like 127.99.99.99.
    Will a thread be more appropriate since i am using threads in proxy and server?Only if you have multiple connections in the client at the same time, or if the client's input and output are unco-ordinated. From your description it sounds like you are writing requests and reading responses, which you can do serially without threads.
    2. My understanding of proxy is that it is partly a server, and partly a client. But i am not sure if i am right to create 2 threads to handle upstream and downstream operations independently.You are right.
    3. As for the server side. i have similar issues regarding the IP address problems mentioned above.I don't know exactly what you mean by 'issues' or 'problems'. You can run the whole setup using 127.0.0.1, or 'localhost', with one listening port for the proxy and another for the server.

  • Error running a client side program through the worklist app

    I am trying to run a simple client side application (actually just a command script
    that does a pause). I construct a send xml to client with a "call-program" message
    with attributes of name="c:\testscript" and mode of async.
    It appears that I need to register the program - how do I do this?
    SecurityException: Cannot execute the system command "c", because it has not been
    registered in the
    WLPI Security Manager configuration file C:\Documents and Settings\nvernon\WLPISec.properties
    java.lang.SecurityException: Cannot execute the system command "c", because it
    has not been registered in the
    WLPI Security Manager configuration file C:\Documents and Settings\nvernon\WLPISec.properties
         at com.bea.wlpi.client.common.WLPISecurityManager.checkExec(WLPISecurityManager.java:141)
         at java.lang.Runtime.exec(Runtime.java:548)
         at java.lang.Runtime.exec(Runtime.java:477)
         at com.bea.wlpi.client.worklist.WorklistPane$6.run(WorklistPane.java:1441)
         at java.lang.Thread.run(Thread.java:484)

    The reason I asked about the computer OS was in case you needed to do a clean install of iTunes. It works differently on the Mac computer than on Windows. A complete uninstall and reinstall on a Windows computer requires you to follow specific instructions in a support document, while on a Mac, I have read you just have to reinstall over the old one.
    I'm not sure if installing/updating to iTunes 11 would be the same on Windows or not, but since you report using a Mac, then it is probably a mute point. Good luck.

  • Sending a pdf file using submit without client email program.

    I need a solution on sending a completed pdf file to my email address without the clients email program poping up.  My website has a small pdf file that users can complete and return to me.  I get many complaints from users stating it requires them to save the file first and then they are unsure were it saved or how to attach it to a email.  To make this easer on my users I want the submit button to simply send me the file using some method from my website.  I use iPage to host the site now.  I was looking for a script to call or some way to do this automaticly.  I was woundering if urs/sbin/sendmail might work.  I am simply at a loss on this.

    Using a sendmail type script will send you the form data in the body of an email message, if the form is set up to submit as "HTML". You can create your own script to attach the form data as an FDF, XFDF, or even the complete PDF, but it's unlikely your provider supplies a script for this, so you'd have some custom programming to do.
    Sending just the form data also avoids the licensing restrictions for Reader-enabled forms. You can easily import an FDF or XFDF into a blank form to create a filled-in form.

  • Client host rejected: Access denied

    Getting a ton of bounced back emails most likely the address is no longer in use but I filtered out any of the emails that say so.  I'm no professional at this thats why I'm looking for help here. I tried searching for the problem on the forum but found
    stuff about server 2003.  
    Im getting alot of the kickbacks saying Client host rejected: Access denied
    I've tried emailing the recipient on my personal Gmail and recieved the same error. can we safely say that the addresses are no longer in use that i'm getting these kickbacks? heres the full header for anyone
    who wants to look.
    The original message was received at Wed, 5 Mar 2014 15:29:34 -0500 from odbmap07.extra.chrysler.com [129.9.107.35]
       ----- The following addresses had permanent fatal errors ----- <mail address here>
        (reason: 554 5.7.1 <unknown[151.171.97.83]>: Client host rejected: Access denied)
       ----- Transcript of session follows ----- ... while talking to odbmap07.out.extra.chrysler.com.:
    <<< 554 5.7.1 <unknown[151.171.97.83]>: Client host rejected: Access denied
    554 5.0.0 Service unavailable
    We are using someone to host our email server for more information.
    I use a program called G-Lock easy mail to send out our newsletter.

    Hi,
    Which email client are you using to send and receive emails? G-Lock?
    Please refer to the links below and check if they help:
    http://www.symantec.com/business/support/index?page=content&id=TECH169847
    http://support.mailhostbox.com/email-administrators-guide/error-codes
    In addition, if you are not using Microsoft Outlook as your email client, it's better to contact the support for your mail client for further assistance.
    Best Regards,
    Steve Fan
    TechNet Community Support

  • File transfer, read write through sockets in client server programming java

    Hello All, need help again.
    I am trying to create a Client server program, where, the Client first sends a file to Server, on accepting the file, the server generates another file(probably xml), send it to the client as a response, the client read the response xml, parse it and display some data. now I am successful sending the file to the server, but could not figure out how the server can create and send a xml file and send it to the client as response, please help. below are my codes for client and server
    Client side
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class XMLSocketC
         public static void main(String[] args) throws IOException
              //Establish a connection to socket
              Socket toServer = null;
              String host = "127.0.0.1";     
              int port = 4444;
              try
                   toServer = new Socket(host, port);
                   } catch (UnknownHostException e) {
                System.err.println("Don't know about host: localhost.");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for the connection to host.");
                System.exit(1);
              //Send file over Socket
            //===========================================================
            BufferedInputStream fileIn = null;
              BufferedOutputStream out = null;
              // File to be send over the socket.
              File file = new File("c:/xampp/htdocs/thesis/sensorList.php");
              // Checking for the file to be sent.
              if (!file.exists())
                   System.out.println("File doesn't exist");
                   System.exit(0);
              try
                   // InputStream to read the file
                   fileIn = new BufferedInputStream(new FileInputStream(file));
              }catch(IOException eee)
                   System.out.println("Problem, kunne ikke lage fil");
              try
                   InetAddress adressen = InetAddress.getByName(host);
                   try
                        System.out.println("Establishing Socket Connection");
                        // Opening Socket
                        Socket s = new Socket(adressen, port);
                        System.out.println("Socket is clear and available.....");
                        // OutputStream to socket
                        out = new BufferedOutputStream(s.getOutputStream());
                        byte[] buffer = new byte[1024];
                        int numRead;
                        //Checking if bytes available to read to the buffer.
                        while( (numRead = fileIn.read(buffer)) >= 0)
                             // Writes bytes to Output Stream from 0 to total number of bytes
                             out.write(buffer, 0, numRead);
                        // Flush - send file
                        out.flush();
                        // close OutputStream
                        out.close();
                        // close InputStrean
                        fileIn.close();
                   }catch (IOException e)
              }catch(UnknownHostException e)
                   System.err.println(e);
            //===========================================================
            //Retrieve data from Socket.
              //BufferedReader in = new BufferedReader(new InputStreamReader(toServer.getInputStream()));
              DataInputStream in = new DataInputStream(new BufferedInputStream(toServer.getInputStream()));
              //String fromServer;
            //Read from the server and prints.
              //Receive text from server
              FileWriter fr = null;
              String frn = "xxx_response.xml";
              try {
                   fr = new FileWriter(frn);
              } catch (IOException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              try{
                   String line = in.readUTF();                    //.readLine();
                   System.out.println("Text received :" + line);
                   fr.write(line);
              } catch (IOException e){
                   System.out.println("Read failed");
                   System.exit(1);
            in.close();
            toServer.close();
    public class XMLSocketS
          public static void main(String[] args) throws IOException
              //Establish a connection to socket
               ServerSocket serverSocket = null;
                 try {
                     serverSocket = new ServerSocket(4444);
                 } catch (IOException e) {
                     System.err.println("Could not listen on port: 4444.");
                     System.exit(1);
              Socket clientLink = null;
              while (true)
                        try
                             clientLink = serverSocket.accept();
                           System.out.println("Server accepts");
                             BufferedInputStream inn = new BufferedInputStream(clientLink.getInputStream());
                             BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:/xampp/htdocs/received_from_client.txt")));
                             byte[] buff = new byte[1024];
                             int readMe;
                             while( (readMe = inn.read(buff)) >= 0)
                             {     //reads from input stream, writes the file to disk
                                  ut.write(buff, 0, readMe);
                             // close the link to client
                             clientLink.close();                         
                             // close InputStream
                             inn.close();                         
                             // flush
                             ut.flush();                         
                             // close OutputStream
                             ut.close();     
                             //Sending response to client     
                             //============================================================
                             //============================================================
                             System.out.println("File received");
              }catch(IOException ex)
              {System.out.println("Exception.");}
                        finally
                             try
                                  if (clientLink != null) clientLink.close();
                             }catch(IOException e) {}
                 clientLink.close();
                 //serverSocket.close();
    }

    SERVER
    import java.net.*;
    import java.io.*;
    public class XMLSocketS
          public static void main(String[] args) throws IOException
                   //Establish a connection to socket
               ServerSocket serverSocket = null;
                 try {
                     serverSocket = new ServerSocket(4545);
                 } catch (IOException e) {
                     System.err.println("Could not listen on port: 4444.");
                     System.exit(1);
              Socket clientLink = null;
                  try
                             clientLink = serverSocket.accept();
                         System.out.println("Server accepts the client request.....");
                         BufferedInputStream inn = new BufferedInputStream(clientLink.getInputStream());
                             BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:/xampp/htdocs/received_from_client.txt")));
                             byte[] buff = new byte[1024];
                             int readMe;
                             while( (readMe = inn.read(buff)) >= 0)
                             {     //reads from input stream, writes the file to disk
                                  ut.write(buff, 0, readMe);
                             ut.flush();                         
                             //Sending response to client     
                             //============================================================
                             BufferedInputStream ftoC = null;
                             BufferedOutputStream outtoC = null;
                             // File to be send over the socket.
                             File file = new File("c:/xampp/htdocs/thesis/user_registration_response.xml");
                             try
                                  // InputStream to read the file
                                   ftoC = new BufferedInputStream(new FileInputStream(file));
                             }catch(IOException eee)
                             {System.out.println("Problem reading file");}
                             // OutputStream to socket
                             outtoC = new BufferedOutputStream(clientLink.getOutputStream());
                             byte[] buffer = new byte[1024];
                             int noRead;
                             //Checking if bytes available to read to the buffer.
                             while( (noRead = ftoC.read(buffer)) >= 0)
                                  // Writes bytes to Output Stream from 0 to total number of bytes
                                  outtoC.write(buffer, 0, noRead);
                             outtoC.flush();
                             //============================================================
                             System.out.println("File received");
              }catch(IOException ex)
              {System.out.println("Exception.");}
                        finally
                             try
                                  if (clientLink != null) clientLink.close();
                             }catch(IOException e) {}
                 clientLink.close();
                 //serverSocket.close();
          }CLIENT SIDE
    import java.io.*;
    import java.net.*;
    public class XMLSocketC
              @SuppressWarnings("deprecation")
              public static void main(String[] args)
                   // Server: "localhost" here. And port to connect is 4545.
                   String host = "127.0.0.1";          
                   int port = 4545;
                   BufferedInputStream fileIn = null;
                   BufferedOutputStream out = null;
                   // File to be send over the socket.
                   File file = new File("c:/xampp/htdocs/thesis/sensorList.xml");
                   try
                        // InputStream to read the file
                        fileIn = new BufferedInputStream(new FileInputStream(file));
                   }catch(IOException eee)
                   {System.out.println("Problem");}
                   try
                             System.out.println("Establishing Socket Connection");
                             // Opening Socket
                             Socket clientSocket = new Socket(host, port);
                             System.out.println("Socket is clear and available.....");
                             // OutputStream to socket
                             out = new BufferedOutputStream(clientSocket.getOutputStream());
                             byte[] buffer = new byte[1024];
                             int numRead;
                             //Checking if bytes available to read to the buffer.
                             while( (numRead = fileIn.read(buffer)) >= 0)
                                  // Writes bytes to Output Stream from 0 to total number of bytes
                                  out.write(buffer, 0, numRead);
                             // Flush - send file
                             out.flush();
                             //=======================================
                             DataInputStream in = new DataInputStream(new BufferedInputStream(clientSocket.getInputStream()));
                             BufferedWriter outf = new BufferedWriter(new FileWriter("c:/xampp/htdocs/received_from_server.txt",true));
                             String str;
                             while(!(str = in.readLine()).equals("EOF")) {     
                                  System.out.println("client : Read line -> <" + str + ">");
                                  outf.write(str);//Write out a string to the file
                                  outf.newLine();//write a new line to the file (for better format)
                                  outf.flush();
                             //=======================================
                             // close OutputStream
                             out.close();
                             // close InputStrean
                             fileIn.close();
                             // close Socket
                             clientSocket.close();
                        }catch (IOException e)
                        {System.out.println("Exception.");}
         Could you please point where am I doing the stupid mistake, client to server is working properly, but the opposite direction is not.
    Thanks

  • Client/server program: Urgent, pls help!!

    I am new to Java, particularly Networking in Java, while writing client/server application I have got completely strucked now. Can any one give me an idea where I am wrong?
    I am writing a simple client server application in Java using Socket and ServerSocket classes as a part of my course work. Through client I am just establishing connection with server, getting user inputs/commands, sending the same input to server (server will capitalize this input and return it back to client), receiving and displaying server�s response.
    The connection is established fine. Even it is accepting users input well but I am getting runtime NullPointerException while trying to send it to server. Here is the working of my client command window.
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin\abc>javac TClient.java
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin\abc>java TClient
    Enter the message
    hello
    Exception in thread "main" java.lang.NullPointerException
    at TClient.Send_Message(TClient.java:46)
    at TClient.main(TClient.java:76)
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin\abc>
    As soon as I get this exception the connection with server is lost and I get this in server command window.
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin\abc>javac TCPServer.java
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin\abc>java TCPServer
    Exception in thread "main" java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168)
    at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java
    :2150)
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream
    .java:2163)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputS
    tream.java:2631)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:734
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
    at TCPServer.main(TCPServer.java:17)
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin\abc>
    Here is my code for server (TCPServer.java)
    import java.io.*;
    import java.net.*;
    class TCPServer {
      public static void main(String argv[]) throws Exception
          String clientSentence;
          String capitalizedSentence;
          ServerSocket welcomeSocket = new ServerSocket(80);
          while(true) {
                       Socket connectionSocket = welcomeSocket.accept();
               ObjectInputStream inFromClient =  new ObjectInputStream(connectionSocket.getInputStream());
               ObjectOutputStream  outToClient =
                 new ObjectOutputStream(connectionSocket.getOutputStream());
               clientSentence = (String ) inFromClient.readObject();
               capitalizedSentence = clientSentence.toUpperCase() + '\n';
               outToClient.writeObject(capitalizedSentence);
    And this is for Client (TClient.java)
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class TClient {
         private ObjectOutputStream  server_output;
                private ObjectInputStream server_input;
         private Socket client;
         private void server_connect() throws IOException
              client = new Socket(InetAddress.getLocalHost(), 80);
         private void getstreams() throws IOException
          server_output = new ObjectOutputStream (client.getOutputStream());
          server_output.flush();     
             server_input = new ObjectInputStream(client.getInputStream());
         private String get_cmd_frm_usr() throws IOException
              BufferedReader inFromUser =
                         new BufferedReader(new InputStreamReader(System.in));
              String sentence;
              System.out.println("Enter the message");
              sentence = inFromUser.readLine();
              /*StringTokenizer st = new StringTokenizer(sentence);
                   while (st.hasMoreTokens()) //separating n printing words of inputted sentence
                       System.out.println(st.nextToken());
         return(sentence);
         private void Send_Message(String msg) throws IOException
              //System.out.println("within send_message method :"+ msg);
              server_output.writeObject( msg );
              server_output.flush();
         private void recieve_n_disp_mess() throws Exception
         String modifiedSentence;
         modifiedSentence = ( String ) server_input.readObject();
         System.out.println("\n\n  by SERVER: " +      modifiedSentence);
            private void close_connection() throws IOException
              client.close();
         public static void main(String args[]) throws Exception
              TClient client = new TClient();
             try{
              client.server_connect();
              String command=client.get_cmd_frm_usr();
              //System.out.println("this is returned from input method n ready to sent to server soon: "+ command);
              client.Send_Message(command);
              client.recieve_n_disp_mess();
              client.close_connection();
                   } catch(EOFException eofException) {}
              catch (IOException ioException) {}          

    you never initialized the server_output and the server_input vriables...
    I see you have the getstreams() function which should initialize them but you never call it...
    so untill you will call it those variables will stay null.
    I can also see you do not implement constructors, its much easier just to implement these instead of functions initializing variables...
    Hope it will help
    private void getstreams() throws IOException
    server_output = new ObjectOutputStream
    (client.getOutputStream());
    server_output.flush();
    server_input = new
    ObjectInputStream(client.getInputStream());
    public static void main(String args[]) throws
    Exception
    TClient client = new TClient();
    try{
    client.server_connect();
    String command=client.get_cmd_frm_usr();
    //System.out.println("this is returned from input method n ready to sent to server soon: "+ command);
    client.Send_Message(command);
    client.recieve_n_disp_mess();
    client.close_connection();
    } catch(EOFException eofException) {}
    catch (IOException ioException) {}

  • Bluetooth simple client example question

    Dear all,
     I am not sure whether I am close to make it. I update my bluetooth driver {http://forums.ni.com/ni/board/message?board.id=170&message.id=301780#M301780}, so it seem the labview (simple bluetooth server example) can work with my bluetooth (please read the first picture). However, the error message comes up when I run the simple client program. I have a question. Do I have to make the client and the server program in two computer?
     I need your help
    Thanks
    ====================
    =Labview 7.0 & 8.0 & 8.5=
    =====================
    Attachments:
    labview5.JPG ‏203 KB
    labview6.JPG ‏214 KB

    Just want to make a couple things clear
    1. my bluetooth device is working well, after I remove dell driver and using XP bluetooth stack <-----I think
    2. I can run the server without no problem, the problem comes from the client part.
    I have attached the pic from the device manager
    Please help, failure will lose my job
    ====================
    =Labview 7.0 & 8.0 & 8.5=
    =====================
    Attachments:
    labview7.JPG ‏41 KB

  • Help me to sort out the problem in this Simple Client - Server problem

    Hi all,
    I have just started Network programming in java . I tried to write simple Client and Server program which follows
    MyServer :
    package connection;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class MyServer {
          * @param args
         public static void main(String[] args) {
              String ss ="";
              try {
                   ServerSocket sockServer = new ServerSocket(6000);
                   Socket clientLink = sockServer.accept();
                   System.out.println("Connection Established");
                   InputStreamReader isr = new InputStreamReader(clientLink.getInputStream());
                   BufferedReader bufReader = new BufferedReader(isr);
                   System.out.println("buf "+bufReader.readLine());
                   try {
                        while ((ss=bufReader.readLine())!=null) {
                             ss+=ss;
                        System.out.println("client message "+ss);
                   } catch (IOException e) {
                        System.out.println("while reading");
                        e.printStackTrace();
              } catch (IOException e) {
                   System.out.println("Can't able to connect");
                   e.printStackTrace();
    }MyClient:
    package connection;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.net.Socket;
    public class MyClient {
          * @param args
         public static void main(String[] args) {
              try {
                   Socket client = new Socket("127.0.0.1",6000);
                   OutputStreamWriter osw = new OutputStreamWriter(client.getOutputStream());
                   PrintWriter pw = new PrintWriter(osw);
                   pw.write("hello");
              } catch (IOException e) {
                   System.out.println("Failed to connect");
                   e.printStackTrace();
    }I got this error message when I start my client program .
    Error message :
    Connection Established
    java.net.SocketException: Connection reset
         at java.net.SocketInputStream.read(Unknown Source)
         at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
         at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
         at sun.nio.cs.StreamDecoder.read(Unknown Source)
         at java.io.InputStreamReader.read(Unknown Source)
    Can't able to connect
         at java.io.BufferedReader.fill(Unknown Source)
         at java.io.BufferedReader.readLine(Unknown Source)
         at java.io.BufferedReader.readLine(Unknown Source)
         at connection.MyServer.main(MyServer.java:27)I think this is very simple one but can't able to find this even after many times . please help me to sort out this to get start my network programming .
    Thanks in advance.

                   System.out.println("buf "+bufReader.readLine());Here you are reading a line from the client and printing it.
                   try {
                        while ((ss=bufReader.readLine())!=null) {
                             ss+=ss;
                        }Here you are reading more lines from the client and adding it to itself then throwing it away next time around the loop.
                        System.out.println("client message "+ss);... so this can't print anything except 'null'.
                   pw.write("hello");Here you are printing one line to the server. So the server won't ever do anything in the readLine() loop above. Then you are exiting the client without closing the socket or its output stream so the server gets a 'connection reset'.

  • Client Server program using Applets for client

    Creating a client server program using Applets for the clients.
    Having problems distrubting the message from client to client
    using ObjectOutputStreams/ObjectInputSteams.
    I can connect each client to simple server and respond with by writting
    the i/o stream of each client but unable to communicate from client to client. If any one out there has in tips of creating a class of objectOutputStreams that holds a array of ObjectOutputStreams and then broadcasts the message to every client, it would be much appreciated
    Thanks.

    Cheers poop for your reply
    I never explained the problem properly. What it is I am trying to set up a Client Server program using Applets as the clients GUI. The problem is broadcasting the message to multiply client connnection(s).
    Below is code, each client can connect and send message to the server. The problems is broadcasting the message to every client connection. The every client can input a message but only the last connected client can receive the message?????? Thanks in advance..
    /*this my server class */
    import java.io.*;
    import java.net.*;
    public class Server extends JFrame
    private static final int ServerPort=8080;
    private static final int MaxClients=10;
    private ObjectOutputStream output=null;
    private ObjectInputStream input=null;
    private BroadCastMessage broadcastMessage;
    public void runServer()          
    BroadCastMessage broadcastMessage= new BroadCastMessage();
    try
    {  //connect to server
    ServerSocket s = new ServerSocket(ServerPort,MaxClients);
         //listen to port 5000 for new connections
         ///max is 25
         System.out.println("Server listening on port "+ServerPort);
    while (state.isProgramRunning())
         try
         /// sGUI.waitForConnection();//new line
         s.setSoTimeout(100);
         //enable times in server-socket
         while (true)     
         Socket incoming = s.accept();
         //wait and accept connnections from serverSocket
         //instance of the class,pases the new connection and message
         //spawn as a thread
         SocketConnection connection=new SocketConnection(incoming,broadcastMessage);
         Thread a = new Thread(connection); a.start();
         System.out.println(state.getConnectionCount()+"Connection received from :"+incoming.getInetAddress());
         catch(InterruptedIOException x){}
    while (state.getConnectionCount()>0);
    System.exit(0);
    }catch (IOException e){}
    public static void main(String[] args)
    Server s =new Server();
         s.runServer();
    /*this is my socket connection thread*/
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    public class SocketConnection implements Runnable
    private ObjectOutputStream out;
    private ObjectOutputStream output=null;
    private ObjectInputStream input=null;
    private BroadCastMessage passOnMessage;
    private Socket theConnection=null;
    private String Inmessage="";
    private int Ocount;
    public SocketConnection(Socket caller,BroadCastMessage broadcastMessage,Ocount)
    theConnection =caller;///(5000,n)
    Ocount=ncount;
    passOnMessage=broadcastMessage;
    public void run()
    try
    getStreams();
    processConnection();
    catch(Exception e)
    {String clientDetails=("connection from IP Address: "+theConnection.getInetAddress());}
    private synchronized void getStreams() throws IOException
    { //get streams to send and receive data
    //set up output buffer to send header information
    ///Ocount++;
    //create new objectoutputstream
    output=passOnMessage.getOutputObject(output,theConnection,Ocount);
    ///flush output buffer to send header info.
    Ocount++;
    //set up input stream for objects
    input =new ObjectInputStream(
    theConnection.getInputStream());
    System.out.print("\nGot I/O streams\n");
    private synchronized void processConnection()throws IOException
    //process connection with client
    String Outmessage =" count : "+status.getConnectionCount();
    //send connection successful message to client
         Outmessage=Outmessage+"SERVER>>>Connection successful";
         output.writeObject(Outmessage);
    output.flush();
    do ///process messages sent from client
         try
         Inmessage = (String) input.readObject();
         System.out.println(Inmessage);
         /* //while the connection is open each line
         that is passed from the client to the server
         is read in and is displayed*/
         messageDetails.setMessage(Inmessage);
         String CurrentMessage=messageDetails.getMessage();
         //output.writeObject(CurrentMessage);
         // output.flush();
         passOnMessage.FloodMessage(CurrentMessage);
         //sending out the message
    catch(ClassNotFoundException classNotFoundException){}
    }while (!Outmessage.equals("CLIENT>>>TERMINATE"));
    /*this my attempt at broadcasting the message to all clients
    my thinking was that you could create a array of objectoutputstreams
    which in turn could be broadcasted(bit confussed here)*/
    import java.io.*;
    import java.net.*;
    public class BroadCastMessage /// implements Runnable
    private int count;
    private String Inmessage="";
    private ObjectOutputStream temp=null;
    private ObjectOutputStream[] output = new ObjectOutputStream [12];
    //temp level of array of objects
    public BroadCastMessage()
    count=0;
    public synchronized void FloodMessage(String message) throws IOException
    System.out.print(count);
         for(int i=0;i<count+1;i++)
         try
    {  System.out.print(count);
         output[count].writeObject(message);
         output[count].flush();
         catch(IOException ioException)
    {ioException.printStackTrace();}
         notifyAll();
    public ObjectOutputStream getOutputObject(ObjectOutputStream out,Socket caller,int Ocount)
    try
    { temp = new ObjectOutputStream(caller.getOutputStream());
         AddObjectOutputStream(temp,Ocount);
    ////FloodMessage();
         catch(IOException ioException)
    {ioException.printStackTrace();}
    return temp;     
    public void AddObjectOutputStream(ObjectOutputStream out,int Ocount)
    { ///add new object to array
    count=Ocount;
    output[count]=out;
    System.out.print("\nthe number of output streams : "+count+"\n");
    }

  • Help with MIDlets - TCP client server program

    Hi I am new to using MIDlets, and I wanted to create a simple TCP client server program.. I found a tutorial in J2me forums and I am able to send a single message from server(PC) to client(Phonemulator) and from client to server. But I want to send a stream of messages to the server. Here is my program and I am stuck in the last step wher i want to send lot of messages to server. Here is my program, Could any one of u tell me how to do it? Or where am i going wrong in thsi pgm?
    Code:
    import java.io.InputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.SocketConnection;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.AlertType;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.StringItem;
    import javax.microedition.lcdui.TextField;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeExcepti on;
    public class SocketMIDlet extends MIDlet
    implements CommandListener, Runnable {
    private Display display;
    private Form addressForm;
    private Form connectForm;
    private Form displayForm;
    private TextField serverName;
    private TextField serverPort;
    private StringItem messageLabel;
    private StringItem errorLabel;
    private Command okCommand;
    private Command exitCommand;
    private Command backCommand;
    protected void startApp() throws MIDletStateChangeException {
    if (display == null) {
    initialize();
    display.setCurrent(addressForm);
    protected void pauseApp() {
    protected void destroyApp(boolean unconditional)
    throws MIDletStateChangeException {
    public void commandAction(Command cmd, Displayable d) {
    if (cmd == okCommand) {
    Thread t = new Thread(this);
    t.start();
    display.setCurrent(connectForm);
    } else if (cmd == backCommand) {
    display.setCurrent(addressForm);
    } else if (cmd == exitCommand) {
    try {
    destroyApp(true);
    } catch (MIDletStateChangeException ex) {
    notifyDestroyed();
    public void run() {
    InputStream is = null;
    OutputStream os = null;
    StreamConnection socket = null;
    try {
    String server = serverName.getString();
    String port = serverPort.getString();
    String name = "socket://" + server + ":" + port;
    socket = (StreamConnection)Connector.open(name, Connector.READ_WRITE);
    } catch (Exception ex) {
    Alert alert = new Alert("Invalid Address",
    "The supplied address is invalid\n" +
    "Please correct it and try again.", null,
    AlertType.ERROR);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert, addressForm);
    return;
    try {
    // Send a message to the server
    String request = "Hello\n\n";
    //StringBuffer b = new StringBuffer();
    os = socket.openOutputStream();
    //for (int i=0;i<10;i++)
    os.write(request.getBytes());
    os.close();
    // Read the server's reply, up to a maximum
    // of 128 bytes.
    is = socket.openInputStream();
    final int MAX_LENGTH = 128;
    byte[] buf = new byte[MAX_LENGTH];
    int total = 0;
    while (total<=5)
    int count = is.read(buf, total, MAX_LENGTH - total);
    if (count < 0)
    break;
    total += count;
    is.close();
    String reply = new String(buf, 0, total);
    messageLabel.setText(reply);
    socket.close();
    display.setCurrent(displayForm);
    } catch (IOException ex) {
    Alert alert = new Alert("I/O Error",
    "An error occurred while communicating with the server.",
    null, AlertType.ERROR);
    alert.setTimeout(Alert.FOREVER);
    display.setCurrent(alert, addressForm);
    return;
    } finally {
    // Close open streams and the socket
    try {
    if (is != null) {
    is.close();
    is = null;
    } catch (IOException ex1) {
    try {
    if (os != null) {
    os.close();
    os = null;
    } catch (IOException ex1) {
    try {
    if (socket != null) {
    socket.close();
    socket = null;
    } catch (IOException ex1) {
    private void initialize() {
    display = Display.getDisplay(this);
    // Commands
    exitCommand = new Command("Exit", Command.EXIT, 0);
    okCommand = new Command("OK", Command.OK, 0);
    backCommand = new Command("Back", Command.BACK, 0);
    // The address form
    addressForm = new Form("Socket Client");
    serverName = new TextField("Server name:", "", 256, TextField.ANY);
    serverPort = new TextField("Server port:", "", 8, TextField.NUMERIC);
    addressForm.append(serverName);
    addressForm.append(serverPort);
    addressForm.addCommand(okCommand);
    addressForm.addCommand(exitCommand);
    addressForm.setCommandListener(this);
    // The connect form
    connectForm = new Form("Connecting");
    messageLabel = new StringItem(null, "Connecting...\nPlease wait.");
    connectForm.append(messageLabel);
    connectForm.addCommand(backCommand);
    connectForm.setCommandListener(this);
    // The display form
    displayForm = new Form("Server Reply");
    messageLabel = new StringItem(null, null);
    displayForm.append(messageLabel);
    displayForm.addCommand(backCommand);
    displayForm.setCommandListener(this);

    Hello all,
    I was wondering if someone found a solution to this..I would really appreciate it if u could post one...Thanks a lot..Cheerz

  • HELP:USING CLIENT SERVER PROGRAM ON DIFF.MACHINES CONNECTED TO INTERNET?

    BELOW IS THE JAVA CODE FOR CLIENT & SERVER PROGRAM (TCP) USING SOCKET.
    I AM TRYING TO RUN CLIENT & SERVER PROGRAM ON 2 DIFFERENT MACHINES CONNECTED 2 INTERNET
    (1 RUNS SERVER.java & OTHER CLIENT.java).
    IS IT POSSIBLE WITH THE CODE WRITTEN BELOW?
    // Server.Java
    import java.net.*;
    import java.io.*;
    class Server {
    public static void main(String[] args) {
    boolean finished = false;
    try{
    ServerSocket listener = new ServerSocket(4444);
    while(!finished)
    {Socket to_client = listener.accept();
    OutputStream out = to_client.getOutputStream();
    PrintWriter pout = new PrintWriter(out, true);
    pout.println("Hello! this is server talking to you.");
    to_client.close();
    listener.close();
    }// end of try
    catch(Exception ie) {
    System.out.println(ie);
    //Client.Java
    import java.net.*;
    import java.io.*;
    class Client
    public static void main(String[] args)
    Socket client;
    String host="serverpcname";//host is assigned name of the server
    try
    {InetAddress adressen = InetAddress.getByName(host);
      client = new Socket(adressen,4444);
      BufferedReader scanf = new BufferedReader(new
      InputStreamReader(client.getInputStream()));
       String someString = scanf.readLine();
       System.out.println("From Server: "+someString);
      client.close();
    catch(Exception e)
    System.out.println(e);
    WHEN THE CODE IS EXECUTED(CLIENT.java ON 1 PC & SERVER.java on other) IT GIVES FOLLOWING EXCEPTIONS:
    java.net.UnknownHostException: serverpcname: serverpcname
    PLZ. GUIDE ME.
    THANKS IN ADVANCE.

    For a server to be accessible on the inetrnet it needs to have an externally visible IP address. For example, an address which starts with 192.168.1 is for internal use only can only be used by other machines on the same internal network. The server's firewall needs to allow the port you are using access and the client has to be able to lookup up the IP address either using the hosts file or via a DNS service. None of these things have anything to do with Java programming, so if you have any more questions I sugegst you try googling them or ask a forum which relates to these issues.
    The connection time out is due to the fact that there is no way to contact an inetrnal address over the inetrnet. The host unknwown means you haven't configured your PC to lookup that address. i.e. the host is unknown.

  • Host Programs

    Hi,
    My client moves Oracle APPS from UNIX to NT.
    There was some host programs (shell scripts) that is registered as concurrent programs and called by submitting a request through SRS.
    Now how to go about the same program in NT?
    Should I have to re-write them as a .bat file? and register them with APPS
    Or is there any workaround?
    Thanks in advance
    Regards
    Murugavel

    You can make use tools which will help you run unix shell scripts under WindowsNT. This can avoid re-writing.
    Couple of tools available are MKS Tool Kit and Cygwin.
    -Jey

  • About the communication issues in the client-server program

    About the communication issues in the client-server program
    Hi, I have some questions about the communication issues in a java project, which is basically the client and server architecture. In brief, the client, written in java, can be deployed anywhere, and in the following part, assume it is in the LAN (Local Area Network) which is connnected to the internet through the firewall and/or proxy, and the server, written in
    java too, simply provides the listening service on a port in a remote machine. And assume the server is connected to the internet directly so that the scenario can be simple to focus on the core questions.
    My questions are as follows:
    1 About the relationship between the communication port and protocol
    Generally, protocols at the application level like HTTP, FTP have their own default port, e.g., HTTP is corresponding to 80,
    FTP is to 25. But it is NOT necessary for the web server to provide the HTTP listening service at port 80, right? E.g, Tomcat provides the HTTP listening service at 8080. So it means the default relationship between the application protocl and their port is some routine, which is not necessary to follow, right?
    2 Assume a LAN connected to the internet through a proxy, which only allows HTTP protocol, then questions are:
    2.1 Does the proxy recognize the HTTP request from the client by the port number (carried in the request string)? For example, when the server provides the HTTP listening service at 80, then the request from the client will include the port number 80, then the proxy will parse such info and decide if or not the request can be out.
    2.2 Does the proxy recognize the HTTP request from the client by protocol (carried in the request string)? For example, the protocol used in the communicatin should be included in the request, then the proxy can parse it to make the decision.
    3 In java programm, if using the HTTP protcol, then on the client: the corresponding API is java.net.URLConnection, right?
    If using the TCP protocol directly, then on the client:the corresponding API is java.net.Socket, right? In both cases, the server side use the same API, java.net.ServerSocket?
    Is it correct to say that the communication by Socket is faster than URLConnection?
    4 Take MSN messenger for example, which protocol does it use? Since proxy configure is only the possible option, so I guess generally the TCP protocol is used directly so that the better perfomrance can be achieved, right?
    5 Given 3 computers within the same LAN, can the client, proxy, server environment above be correctly simulated? If so, can
    you recommend me some typical proxy program so that I can install it to configure such an enviroment to perform some test?
    6 I guess there should be some software to find out which port number a given program/process is going through to connect to
    the remote machine, and which port number a given program/process is listening on? Also, what protocl is used in the given
    communication.
    7 Finally, regarding each of the above questions, it will be highly appreciated that if you can recommed some references,
    tutorials, books etc. In summary, what I care about is how to enable the java client behind the proxy and firewall to
    communicate with the remote server without problems, so if you know some good tutorials plz let me know and thx in advance!
    Finally, thanks for your attention so such long questions =).

    FTP is to 25. But it is NOT necessary for the web
    server to provide the HTTP listening service at port
    80, right? E.g, Tomcat provides the HTTP listening
    service at 8080. So it means the default relationship
    between the application protocl and their port is
    some routine, which is not necessary to follow,
    right?Not sure what you're saying here.
    There must be a server listening on some port. The client must know what port that is. If you open the connection using the Socket class, you'll explicitly specify the port. If you use some higher level class like URLConnection or something in the commons Net package, there's probably a default port that will be used if you don't explicitly specify another.
    There's no way for the client to know that the HTTP request will go to port 80 instead of port 8080. If you think the the client contacts the server without explicitly naming a port, and then asks the server "get me your HTTP server", and the port is determined from that, you're mistaken.
    Not sure if you're thinking that, but it sounded like you might be.
    2 Assume a LAN connected to the internet through
    a proxy, which only allows HTTP protocol, then
    questions are:
    2.1 Does the proxy recognize the HTTP request
    from the client by the port number (carried in the
    request string)? For example, when the server
    provides the HTTP listening service at 80, then the
    request from the client will include the port number
    80, then the proxy will parse such info and decide if
    or not the request can be out. I'm not sure, but I think most proxies and firewalls are configured by ports. I thought I'd heard of more sophisticated, higher-level ones that could understand the content to some degree, but I don't know anything about those.
    3 In java programm, if using the HTTP protcol,
    then on the client: the corresponding API is
    java.net.URLConnection, right?That's one way.
    You might want to look into this:
    http://jakarta.apache.org/commons/httpclient/
    If using the TCP protocol directly, then on the
    client:the corresponding API is java.net.Socket,
    right? In both cases, the server side use the same
    API, java.net.ServerSocket? A Java client will user Socket, and a Java server will use ServerSocket and Socket.
    Is it correct to say that the communication by Socket
    is faster than URLConnection?Probably not.

  • Concurrent HOST program calling a proc to log using fnd_file.put_line

    Hello all,
    I have a concurrent HOST program that does 3 main things
    1. Calls a sqlplus program to do some initializing. This program is a proc in a package.
    2. Runs sqlldr to load data to custom tables.
    3. Calls a sqlplus program to do manipulate the data. This program is a proc in a package.
    In step 3 of above, the package procedue does a "submit_request" to call the "Supplier Open Interface Import". This
    request actually fires. However my problem is the subsequent call to fnd_file.put_line(fnd_file.log, 'Test message'), does not get logged
    to the log file of the HOST program, nor to the log file of the "Supplier Open Interfface Import" log file. A check
    of $APPLPTMP (or /usr/tmp) shows that a file of say " l0023761.tmp" contains my 'Test message' text.
    I believe the problem is that the put_line() call has no association with the HOST or the "Supplier Open Interface Import. How
    do I associate the logging to either program? Is it even possible? I want the logging, so as to see the progress
    of the HOST program.
    The sniippet of proc code is:
    PROCEDURE abc() IS
    BEGIN
    request_id:= FND_REQUEST.SUBMIT_REQUEST
    (Application => 'SQLAP'
    ,Program => 'APXSUIMP'
    ,Description => NULL
    ,Start_time => SYSDATE
    ,Sub_Request => FALSE
    ,Argument1 => 'ALL'
    ,Argument2 => 1000
    ,Argument3 => 'N'
    ,Argument4 => 'N'
    ,Argument5 => 'N'
    fnd_file.put_line (fnd_file.log,'Test message');
    COMMIT;
    END abc;
    Alex.

    Shell scripts are very hard to develop and maintain. Many things that developers previously had to do in shell scripts, developers can now do in PL/SQL. Hence, I recommend that you avoid shell scripts as much as possible.
    As well, SQL*Loader is an old, inflexible tool. Instead, define your OS file as an external table, and then extract from the external table using a normal select statement. http://www.orafaq.com/node/848 I recommend that you avoid SQL*Loader and use external tables instead.
    Using PL/SQL and external tables - and avoiding the shell script and SQL*Loader - a much better way to accomplish the same thing all inside one packaged procedure that is registered as a concurrent program:
    - initialize
    - select from the external table
    - manipulate the data

Maybe you are looking for

  • Count issue of output in Web I report

    Hi, We are using Web I XI R2 and facing issue with the ouput while using count formula as described below. I am able to get the right output for below formula when used without breaks Formula       =Count([Risk ID*] Where (([Risk Impact] = "High" Or

  • How do I sign multiple fields in a pdf without saving untill the end?

    I have Acrobat 9 and I am trying to put in 20-50 signature fields all to be signed by the same person in one to however many sittings.  For every signature it prompts to "Save As".  I work in the medical field so all our training is tied up in medica

  • How do I change the default paper size in Firefox if Printer Properties does nothing?

    I print on different including a receipt printer with roll paper. I had to reset Firefox yesterday because of a bug, and then changed the Printer Properties to be able to print again in the right format on the receipt paper. But now everything I prin

  • Apple tv Slow download

    Films need nearly tío hours to be downloaded.

  • Apple TV best connection

    Hello, I have 3 apple tv's 3rd generation connected to wifi. I also have 3 airport express being used as extenders to boost the signal in my house. My question is would I get a faster connection if I connected a apple tv to a airport express via ethe