Socket Programming EOFException problem

Can anyone give me a detailed explanation on when does this error happen?
java.io.EOFException
at java.io.DataInputStream.readUnsignedShort(Unknown Source
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at Client.main(Client.java:40)

Thanks again.
Here is the snippet of code:
public Socket s;
public DataInputStream i;
public DataOutputStream o;
s = new Socket (socketServerIP, Integer.parseInt (socketServerPort));
i = new DataInputStream(new BufferedInputStream(s.getInputStream()));
o = new DataOutputStream(new BufferedOutputStream(s.getOutputStream()));
try {
while (true) {
String line = i.readUTF ();
System.out.println("- Message from server : " + line);
} catch (IOException ex) {
System.out.println(ex);
ex.printStackTrace();
As far as i know, I am just trying to accept any input from the server without determining its content length or other data information. Is there something wrong or lacking with my code?
I would really appreciate if you would comment on this once again. =)

Similar Messages

  • Desktop to socket programming conversion problem?

    i have a Online desktop application.
    i want to convert in Socket programming for Efficiency and Quick response.
    i successfully connect client to server and server to client its work well.
    now problem is that i had in application different type of objects , Database quires results, some Business class and other needed class.
    how i pass these thinks to server to client and vice versa and distinguish them?

    I am very THANK Full for your Efforts
    i locked my xml file succssfuly; but i still got same exception
    locking a file code
    Initializing streams
    try {
                is = new ObjectInputStream(clientSocket.getInputStream());
                os = new ObjectOutputStream(clientSocket.getOutputStream());
               fs = new FileOutputStream("first.xml");
                BufferedOutputStream br = new BufferedOutputStream(fs);
                xml = new XMLEncoder(br);
            } catch (IOException e) {
                System.out.println(e);
    Locking a file it display file is locked
         System.out.println("Trying to lock locked..");
          fl = fs.getChannel().tryLock();
          System.out.println("File locked..");
          xml.writeObject(ud);
          xml.flush();
          fl.release();
          System.out.println("lock released...");    
          fl.release();
          is.close();
          os.close();
          xml.close();
          clientSocket.close();       

  • Socket Programming Problem

    I am using multi threading with socket programming. One thread uses socket's output stream to send the data and the other thread keeps waiting for the data to arrive from that socket's input stream.
    Now when the readLine or readObject is excuting on the receiver thread it will be blocked untill data arrives. In which case sending thread will not be able to send the data.
    Now is there any way to make the readLine or readObject method non blocking?
    Please advise ASAP
    thnks

    Below is an example of a simple blocking multi-threaded client program that connects to google. I don't believe I've ever experienced a problem like you're describing before while dealing with Java sockets; perhaps this will give you an idea about what's going wrong. One thread reads from stdin, the other (the main-thread of execution) reads from the socket and writes to the screen.
    java Test
    Then do a GET request to the HTTP server:
    "GET / HTTP/1.0"
    Then press return again and watch it send you google's root page.
    import java.net.*;
    import java.io.*;
    class Test
        Test()
         try
              Socket mySocket = new Socket("www.google.com", 80);
              BufferedReader myReader;
              final BufferedWriter myWriter;
              myWriter = new BufferedWriter(new OutputStreamWriter(mySocket.getOutputStream()));
              Thread myThread = new Thread()
                   public void run()
                       System.out.println("here");
                       try
                       BufferedReader inputReader = new BufferedReader(new InputStreamReader(System.in));
                       String str;
                       while((str = inputReader.readLine()) != null)
                            myWriter.write(str);
                            myWriter.write("\n");
                            myWriter.flush();
                       catch(IOException e)
                        System.err.println("Error reading from stdin.");
                        System.exit(-1);
              myThread.start();
                       System.out.println("there");
              myReader = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
              String str;
              while((str = myReader.readLine()) != null)
                   System.out.println(str);
         catch(IOException hostExcep)
              System.out.println("Host terminated the connection!");
              hostExcep.printStackTrace();
        public static void main(String args[])
         new Test();
    }

  • Simple Socket Programming, But,.......

    This code is Server, Client Socket program code.
    Client send data to server and then, Server get data and save it
    to file in server.
    I think client works well.
    But, Server.java file have some problem.
    It generate ClassNotFoundException!
    So the result file have garbage value only.
    Any idea please................
    /////////////////////////// Server.java /////////////////////////////////
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Server extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectInputStream input;
         ObjectOutputStream output;
         FileOutputStream resultFile;
         public Server(){
              super("Server");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent ev){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display),
                   BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runServer(){
              ServerSocket server;
              Socket connection;
              int counter = 1;
              display.setText("");
              try{
                   server = new ServerSocket(8800, 100);
                   while(true){
                        display.append("Waiting for connection\n" + counter);
                        connection = server.accept();
                        display.append("Connection " + counter +
                             "received from: " + connection.getInetAddress().getHostName());
                        resultFile = new FileOutputStream("hi.txt");
                        output = new ObjectOutputStream(resultFile);
                        output.flush();
                        input = new ObjectInputStream(
                             connection.getInputStream()
                        display.append("\nGod I/O stream, I/O is opened\n");
                        enter.setEnabled(true);
                        DataForm01 data = null;
                        try{
                             data = (DataForm01) input.readObject();
                             output.writeObject(data);
                             data = (DataForm01) input.readObject();
                             output.writeObject(data);
                        catch(NullPointerException e){
                             display.append("Null pointer Exception");
                        catch(ClassNotFoundException cnfex){
                             display.append("\nUnknown Object type received");
                        catch(IOException e){
                             display.append("\nIOException Occured!");
                        if(resultFile != null){
                             resultFile.flush();
                             resultFile.close();
                        display.append("\nUser Terminate connection");
                        enter.setEnabled(false);
                        input.close();
                        output.close();
                        connection.close();
                        ++counter;
              catch(EOFException eof){
                   System.out.println("Client Terminate Connection");
              catch(IOException io){
                   io.printStackTrace();
              display.append("File is created!");
         public static void main(String[] args){
              Server app = new Server();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runServer();
    /////////////////////////// client.java /////////////////////////////////
    * Client.java
    * @author Created by Omnicore CodeGuide
    package Client;
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectOutputStream output;
         String message = "";
         //DataForm01 dfrm[];
         public Client(){
              super("Client");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                             //None.
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display), BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runClient(){
              Socket client;
              try{
                   display.setText("Attemption Connection...\n");
                   client = new Socket(InetAddress.getByName("127.0.0.1"), 8800);
                   display.append("Connected to : = " +
                        client.getInetAddress().getHostName());
                   output = new ObjectOutputStream(
                        client.getOutputStream()
                   output.flush();
                   display.append("\nGot I/O Stream, Stream is opened!\n");
                   enter.setEnabled(true);
                   dfrm = new DataForm01[10];
                   for(int i=0; i<10; i++){
                        dfrm[i] = new DataForm01();
                        dfrm.stn = i;
                        dfrm[i].name = "Jinbom" + Integer.toString(i);
                        dfrm[i].hobby = "Soccer" + Integer.toString(i);
                        dfrm[i].point = (double)i;
                   for(int i=0; i<10; i++){
                        try{
                             output.writeObject(dfrm[i]);
                             display.append(dfrm[i].getData());
                        catch(IOException ev){
                             display.append("\nClass is not founded!\n");
                   DataForm01 dfrm = new DataForm01();
                   dfrm.stn=1;
                   dfrm.name="Jinbom";
                   dfrm.hobby = "Soccer";
                   dfrm.point = (double)0.23;
                   DataForm01 dfrm02 = new DataForm01();
                   dfrm02.stn = 1;
                   dfrm02.name = "Jimbin";
                   dfrm02.hobby = "Soccer";
                   dfrm02.point = 0.4353;
                   try{
                        output.writeObject(dfrm);
                        display.append(dfrm.getData());
                        output.writeObject(dfrm02);
                        display.append(dfrm.getData());
                   catch(IOException ev){
                        display.append("\nClass is not founded!\n");
                   if(output != null) output.flush();
                   display.append("Closing connection.\n");
                   output.close();
                   client.close();
              catch(IOException ioe){
                   ioe.printStackTrace();
         public static void main(String[] args){
              Client app = new Client();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runClient();
    /////////////////////////// DataForm01.java /////////////////////////////////
    import java.io.*;
    public class DataForm01 implements Serializable
         int stn;
         String name;
         String hobby;
         double point;
         public String getData(){
              return Integer.toString(stn) + name + hobby + Double.toString(point);

    This is indented code. ^^;
    It's better to view.
    ////////////////////////// Server.java /////////////////////////////////////////
    * Server.java
    * @author Created by Omnicore CodeGuide
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Server extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectInputStream input;
         ObjectOutputStream output;
         FileOutputStream resultFile;
         public Server(){
              super("Server");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent ev){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display),
                     BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runServer(){
              ServerSocket server;
              Socket connection;
              int counter = 1;
              display.setText("");
              try{
                   server = new ServerSocket(8800, 100);
                   while(true){
                        display.append("Waiting for connection\n" + counter);
                        connection = server.accept();
                        display.append("Connection " + counter +
                             "received from: " + connection.getInetAddress().getHostName());
                        resultFile = new FileOutputStream("hi.txt");
                        output = new ObjectOutputStream(resultFile);
                        output.flush();
                        input = new ObjectInputStream(
                             connection.getInputStream()
                        display.append("\nGod I/O stream, I/O is opened\n");
                        enter.setEnabled(true);
                        DataForm01 data = null;
                        for(int i=0; i<10; i++){
                             try{
                                  data = (DataForm01) input.readObject();
                                  if(data == null) break;
                                  output.writeObject(data);
                             catch(NullPointerException e){
                                  display.append("Null pointer Exception");
                             catch(ClassNotFoundException cnfex){
                                  display.append("\nUnknown Object type received");
                             catch(IOException e){
                                  display.append("\nIOException Occured!");
                        DataForm01 data = null;
                        try{
                             data = (DataForm01) input.readObject();
                             output.writeObject(data);
                             data = (DataForm01) input.readObject();
                             output.writeObject(data);
                        catch(NullPointerException e){
                             display.append("Null pointer Exception");
                        catch(ClassNotFoundException cnfex){
                             display.append("\nUnknown Object type received");
                        catch(IOException e){
                             display.append("\nIOException Occured!");
                        if(resultFile != null){
                             resultFile.flush();
                             resultFile.close();
                        display.append("\nUser Terminate connection");
                        enter.setEnabled(false);
                        input.close();
                        output.close();
                        connection.close();
                        ++counter;
              catch(EOFException eof){
                   System.out.println("Client Terminate Connection");
              catch(IOException io){
                   io.printStackTrace();
              display.append("File is created!");
         public static void main(String[] args){
              Server app = new Server();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runServer();
    ////////////////////////// Client.java /////////////////////////////////////////
    * Client.java
    * @author Created by Omnicore CodeGuide
    package Client;
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectOutputStream output;
         String message = "";
         //DataForm01 dfrm[];
         public Client(){
              super("Client");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                             //None.
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display), BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runClient(){
              Socket client;
              try{
                   display.setText("Attemption Connection...\n");
                   client = new Socket(InetAddress.getByName("127.0.0.1"), 8800);
                   display.append("Connected to : = " +
                          client.getInetAddress().getHostName());
                   output = new ObjectOutputStream(
                        client.getOutputStream()
                   output.flush();
                   display.append("\nGot I/O Stream, Stream is opened!\n");
                   enter.setEnabled(true);
                   dfrm = new DataForm01[10];
                   for(int i=0; i<10; i++){
                        dfrm[i] = new DataForm01();
                        dfrm.stn = i;
                        dfrm[i].name = "Jinbom" + Integer.toString(i);
                        dfrm[i].hobby = "Soccer" + Integer.toString(i);
                        dfrm[i].point = (double)i;
                   for(int i=0; i<10; i++){
                        try{
                             output.writeObject(dfrm[i]);
                             display.append(dfrm[i].getData());
                        catch(IOException ev){
                             display.append("\nClass is not founded!\n");
                   DataForm01 dfrm = new DataForm01();
                   dfrm.stn=1;
                   dfrm.name="Jinbom";
                   dfrm.hobby = "Soccer";
                   dfrm.point = (double)0.23;
                   DataForm01 dfrm02 = new DataForm01();
                   dfrm02.stn = 1;
                   dfrm02.name = "Jimbin";
                   dfrm02.hobby = "Soccer";
                   dfrm02.point = 0.4353;
                   try{
                        output.writeObject(dfrm);
                        display.append(dfrm.getData());
                        output.writeObject(dfrm02);
                        display.append(dfrm.getData());
                   catch(IOException ev){
                        display.append("\nClass is not founded!\n");
                   if(output != null) output.flush();
                   display.append("Closing connection.\n");
                   output.close();
                   client.close();
              catch(IOException ioe){
                   ioe.printStackTrace();
         public static void main(String[] args){
              Client app = new Client();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runClient();
    ////////////////////////// DataForm01.java /////////////////////////////////////////
    * DataForm01.java
    * @author Created by Omnicore CodeGuide
    import java.io.*;
    public class DataForm01 implements Serializable
         int stn;
         String name;
         String hobby;
         double point;
         public String getData(){
              return Integer.toString(stn) + name + hobby + Double.toString(point);

  • Socket and PORT problem

    I am new to socket programming. Is there a command in UNIX to see which ports are not occupied?
    Since I have problem right now in my program to close the sockets, will they be closed automatically after I interrupt the program, should I close it manually from the command line?
    TIA.
    mmc

    When you create a Socket, you can either bind to port 0 (which binds to the first available port) or to any other valid Port number. There is no Java-based method for geting the port numbers in-use or available. When your program terminates, the sockets will terminate as well, but the port may not be available for use for a few seconds. This allows for the system to be reset.

  • How to control tcp connection with java tcp socket programing ??

    Hi,
    I am connecting a server as using java socket programming.
    When server close the connection (socket object) as using close() method ,
    I can not detect this and My program continue sending data as if there is a connection with server.
    How to catch the closing connection ( socket ) with java socket programming.
    My Client program is as following :
    import java.io.PrintWriter;
    import java.net.Socket;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        try
                          socket = new Socket("localhost",5555);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            pw.println(i+". message is being send.");
                            Thread.sleep(5000);
        } catch (Exception ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

    I changed the code as following. But I couldn't catch the EOFException when I read from the socket. How can I catch this exception ?
    import java.io.BufferedReader;
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        BufferedReader bufIn=null;
        InputStreamReader inRead=null;
        InputStream in=null;
        try
                          socket = new Socket("localhost",5555);
                          in = socket.getInputStream();
                          inRead = new InputStreamReader(in);
                          bufIn = new BufferedReader(inRead);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            try
                              bufIn.readLine();
                              pw.println(i+". message is being send.");
                              System.out.println(i+". message has been send");
                            } catch (Exception ex2)
                              System.out.println(ex2.toString());
                              System.out.println(i+". message could not be send");
                            } finally
                            Thread.sleep(5000);
        } catch (EOFException ex)
                          ex.printStackTrace();
        } catch (InterruptedException ex)
                          ex.printStackTrace();
        } catch (IOException ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

  • Help in Socket Programing Plz

    Hi everyBody!!!
    I m writing a client/server program in which client requests to the server to get the contents of the directory of the server computer (path of the directory is specified by client).
    Server gets the contents fo the director by using the listFile() method and writes that contents onto the socket.
    but the problem is:
    how i can the read that contents from client side? server writes an array of type File onto the socket by using writeObject() method. And client definately will use readObject() method. but how i can read an array of type File from the client side???

    You gave the answer yourself: The Server may write the ARRAY of Files using write Objects and the Client will use readObject. Arrays are Objects too, so do not loop but just write:
    On server Side
    File [] allFiles = getThemFromSomewhere();
    ObjectOutputStream oout = ...;
    oout.writeObject(allFiles); // no loop here!
    ...On client side:
    ObjectInputStream oin = ...;
    File [] allFiles = (File[])oin.readObject()
    ...Well I don't really understand the way you want to do this, because the Files descriptions will be System dependent (and for FileTransfer FTP was created), so this will only make sense when you do interprocess communication on the same system. What do you want to achieve?

  • Getting ConnectException in linux with Hello World socket program

    Hello
    i'm running a hello world application that uses sockets ( [found here|http://blog.taragana.com/index.php/archive/understanding-java-simplified-hello-world-for-socket-programming/] ) . I'm running it using a windows machine and a linux machine. When the windows machine is the server, and linux the client, no problem, the application works fine. But when the server is linux and the client is in windows i got a
    java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
    in the linux machine i've checked the port being used and it seems to be listening
    logan@logan-desktop:~$ netstat --listening |grep 6500
    tcp6 0 0 [::]:6500 [::]:* LISTEN
    i've also tried changing the port and i got the same error
    and i have to say that there is no firewall installed in the linux machine and in the windows machine i disabled the firewall but i'm still getting the same error
    what else should i check? or any clue about what could be happening?
    thank you in advance
    any help would be appreciated

    puki_el_pagano wrote:
    i'm running a hello world application that uses sockets ( [found here|http://blog.taragana.com/index.php/archive/understanding-java-simplified-hello-world-for-socket-programming/] ) . I'm running it using a windows machine and a linux machine. When the windows machine is the server, and linux the client, no problem, the application works fine. But when the server is linux and the client is in windows i got a
    java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
    in the linux machine i've checked the port being used and it seems to be listening
    logan@logan-desktop:~$ netstat --listening |grep 6500
    tcp6 0 0 [::]:6500 [::]:* LISTEN
    i've also tried changing the port and i got the same error
    and i have to say that there is no firewall installed in the linux machine Are you absolutely sure?
    what else should i check? On the windows box
    open a cmd window
    C:> telnet linuxbox 6500

  • C++ Socket Programming

    Hi all,
    I am facing some problem in Socket programming(C++ & Solaris 5.0).I am using socket as basic connecting point & MEP(Message Exchange Protocol) as high level protocol to send & receive Message & ACK, between two different system. MEP is a protocol through which you can send MSG through Socket & wait for the ACK for the corresponding MSG & go on like this. When I am using our binary(s) between two different Solaris Box (with different IP) the transfer rate is quite good (Send one MSG & get ACK for it takes 1 millisecond).
    But the problem comes when I use the same binary(s) to do the above MSG processing in the same Solaris box (with one IP), throughput goes very low (like 50 millisecond for each MSG processing). I have tried with making the socket to work in non-blocking mod also. But that does not help at all.
    Looking for some quick help & hints to resolve this issue.

    I am facing some problem in Socket programming(C++ & Solaris 5.0)Then you're in the wrong forum. This is a Java Networking forum.

  • Hello, I have created a distribution kit for my program.The problem is that the when the program is installed onto another computer, it fails to communicate with field point (Using FP-AO-200 and FP-AO-1000). Help is greatly appreciated, Thanks faen9901

    Hi Everyone,
    I have a program that sends information(analog output) to lab windows cvi in the form of a text file or user input.
    The program runs on the computers that I have the field point explorer and lab windows cvi installed on. In order to run the program without always installing labwindows/cvi and field point; I wanted to create an executable file that could be load on another computer.
    I used the create distribution kit part of labwindows/cvi to do this.After creating the distribution kit, I then installed it
    to another computer.
    My user interface appears on the screen, when the user clicks on the exe. file, but no data is sent to the field point module. I know that the data is being read from the user and textfile because in it appears in the uir.
    The following are some details about the problem:
    1. On another computer without labwindows/cvi and field point explorer not installed - no data is sent to field point module
    I know this because a current is being read on the current meter connected to field point module.
    My questions are the following:
    1. What are the possible reasons for the data not being sent to the field point module?
    2. Do I still need to create an iak. (Installing Field point Explorer) file stored on any new computer that I install my created distribution kit file too?
    Thankyou very much for any help that you can provide. I greatly appreciate it.
    Faen9901

    Re: Hello, I have created a distribution kit for my program.The problem is that the when the program is installed onto another computer, it fails to communicate with field point (Using FP-AO-200 and FP-AO-1000). Help is greatly appreciated, Thanks faen9901Faen9901,
    1) If you do not install FieldPoint Explorer, the FieldPoint Server is not installed so there is nothing on the target computer that knows how to talk to the FieldPoint system.
    2) Yes, you need an IAK file on the target computer. Assuming the settings (i.e. com port#) are identical you can simply include the iak file as part of the distribution.
    3) You also need to include as part of your installer the file "fplwmgr.dll". If this file is not installed, your program will not be able to access the FieldPoint Server. Alternatively, this file is installed automatically if FieldPoint Explorer detects LabWindows/CVI or Measurement Studio Development versions on the target computer or if you choose to do a custom FieldPoint Explorer installation and
    choose to provide LabWindows/CVI support.
    Regards,
    Aaron

  • TCP/IP socket programming in ABAP

    Hi,
    Is there any method of TCP socket programming in ABAP? For example is there any function module for creating a socket for a IP address and port number. After that, is it possible to send binary/text data to a connected IP/port destination. I need such a solution because I need to send raw data (native commans) to barcode printer on our network which has a static IP address and listens incoming data through a fixed port number specified in its documentation. For a solution, I coded some .NET VB and built a small application that acts as a RFC server program which can be called by SAP according to definitions I made in SM59 (I defined a new TCP connection and it works well sometimes!). In this application, data coming from SAP are transferred to the barcode printer. This is achived by the .NET Socket class library. This solution works well but after a few subsequent call from SAP, connection hangs! SAP cannot call the application anymore, I test the connection in SM59 and it also hangs, so I need to restart the VB application, but this is unacceptable in our project.
    As a result, I decided to code the program that will send data to the printer in ABAP as a function module or subroutine pool, so is there any way to create a socket in ABAP and connect to specific IP/port destination? I searched for possible function modules in SE37 and possible classes in SE24 but unfortunately I could not find one. For example, do know any kind of system function in ABAP (native commands executed by CALL statement), that can be used for this purpose?
    I would appreciate any help,
    Kind regards,
    Tolga
    Edited by: Tolga Togan Duz on Dec 17, 2007 11:49 PM

    Hi,
    I doubt that there is a low level API for sockets in ABAP. There is API for HTTP but probably that won't help you. As a workaround you can use external OS commands (transactions SM69 and SM49). For example on Unix you can use netcat to transfer file. Your FM needs to dump data into folder and then call netcat to transfer file.
    Cheers

  • File descriptor leak in socket programming

    We have a complex socket programming client package in java using java.nio (Selectors, Selectable channel).
    We use the package to connect to a server.
    Whenever the server is down, it tries to reconnect to the server again at regular intervals.
    In that case, the number of open file descriptors build up with each try. I am able to cofirm this using "pfile <pid>" command.
    But, it looks like we are closing the channels, selectors and the sockets properly when it fails to connect to the server.
    So we are unable to find the coding that causes the issue.
    We run this program in solaris.
    Is there a tool to track down the code that leaks the file descriptor.
    Thanks.

    Don't close the selector. There is a selector leak. Just close the socket channel. As this is a client you should then also call selector.selctNow() to have the close take final effect. Otherwise there is also a socket leak.

  • Java Swing and Socket Programming

    I am making a Messenger like yahoo Messenger using Swing and Socket Programming ,Multithreading .
    Is this techology feasible or i should try something else.
    I want to display my messenger icon on task bar as it comes when i install and run Yahoo Messenger.
    Which class i should use.

    I don't really have an answer to what you are asking. But I am developing the same kind of application. I am using RMI for client-server and server-server (i have distributed servers) communication and TCP/IP for client-client. So may be we might be able to help each other out. My email id is [email protected]
    Are you opening a new socket for every conversation? I was wondering how to multithread a socket to reuse it for different connections, if it is possible at all.
    --Poonam.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Network and socket programming in python

    i want to learn network and socket programming but i would like to do this in python.Reason behind this is that python is very simple and the only language i know . 
    anybody can suggest me which book should i pick.
    the book should have following specification--
    1)not tedious to follow
    2)lots of example
    3)starts with some networking stuff and then get into codes
    thanks in advance with regards.

    hmm. well, your requirements are almost contradictory.
    Not sure about books, except maybe dusty's.
    Most python books cover at least some network programming (unless the book is topic specific).
    I use lots of python-twisted at work. I mean ALOT. I wouldn't recommend it to someone looking for non-tedious though! I also like gevent/eventlet (esp. the async socket wrappers).
    EDIT: Wow. My post wasn't really helpful at all. Sorry!
    Last edited by cactus (2010-09-04 09:16:54)

  • Socket Programing in J2ME - Confused with Sun Sample Code

    Hai Everybody,
    I have confused with sample code provided by Sun Inc , for the demo of socket programming in J2ME. I found the code in the API specification of J2ME. The code look like :-
    // Create the server listening socket for port 1234
    ServerSocketConnection scn =(ServerSocketConnection) Connector.open("socket://:1234");
    where Connector.open() method return an interface Connection which is the base interface of ServerSocketConnection. I have confused with this line , is it is possible to cast base class object to the derived class object?
    Plese help me in this regards
    Thanks in advance
    Sulfikkar

    There is nothing to be confused about. The Connector factory creates an implementation of one of the extentions of the Connection interface and returns it.
    For a serversocket "socket://<port>" it will return an implementation of the ServerSocketConnection interface. You don't need to know what the implementation looks like. You'll only need to cast the Connection to a ServerSocketConnection .

Maybe you are looking for