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();
}

Similar Messages

  • Kernel socket programming problem

    I am writing a kernel module on solaris 8 for x86.
    I use the functions in sockfs such as socreate,soconnect and sorecvmsg to
    finish network operations.
    When I had connected to the remote server with soconnect,I can send data
    over the socket(strut sonode*),I can sometime recv data over it, sometime I cannot.
    I got a error return value EFAULT. why?
    If I do not recv any data from the socket, netstat should show that I have data on it.
    But netstat shows empty receive queue.
    Why?

    Thanks, mate!
    It really confuse me that there is only one socket connection between socket client and the server, how can I use different ports to avoid conflict?
    Furthermore, is that true that conflict always happen when data reading from and writing to one socket running at the same time?
    Thanks in advance for your valuable comments!!!
    (the following code is part of my original code)
    ====================================
    socket = new Socket(_host, _port);
    is = new DataInputStream(socket.getInputStream());
    os = new DataOutputStream(socket.getOutputStream());
    // create a thread that keep writing data to socket
    smSender = new SMSender();
    sendThread = new Thread(smSender);
    sendThread.start();
    // create a thread that keep reading data from socket
    smReceiver = new SMReceiver();          
    receiveThread = new Thread(smReceiver);
    receiveThread.start();

  • 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();       

  • 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);

  • 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.

  • 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 .

  • Socket programming usin nio package

    hello frens i m new to socket programming
    i come to know that nio packaage provides more sophisticated and efficient API to deal with socket programming issue
    I need to know where i can get tutorial about socket programming using nio pacakage

    Try google
    http://www.google.co.uk/search?q=java+nio+tutorial

  • Daemon and socket programming

    Hi,
    I have been given a new project whereby I have to:
    1) Write a class with a method that takes as an argument an xml document, communicate s with a SOAP server and return the SOAPs response (in this case a ResponseWrapper object).
    2) This then has to be implemented as a Daemon, that listens to a particular socket.
    The reason for this being is that it can be uploaded to a server, allowing a pearl program to send the XML to the Daemon, have this contact the SOAP server and then return the SOAPs response back to the pearl program.
    I am aware that this sounds unnecessarily complicated but it does have to be implemented this way.
    I have written the class and it successfully communicates with the SOAP server and returns a response, but have no idea how to implement it as a Daemon and have had no experience with socket programming.
    Could anyone point me to a tutorial or give me some pointers in how to get started?
    Thanks,

    It was an option to use a Web Service, but I was told
    that due to security issues it would take to long to
    write all the necessary checks and interceptors
    (which I know how to do), so I should implement it
    this way (which I don't know how to do); since it is
    sitting behind the firewall it would not be
    accessible for spoofing.Huh? You realize that tons of very sensitive information is transmitted all over the internet using Web Services right?
    I have had no experience
    with implementing this type of thing before, What is your level of experience then? This may be over your head. I'm not saying that sockets and daemons are advanced concepts, but I wouldn't throw a beginner into that task.

  • [Urgent]3G Socket programming

    May I use socket for 3G networks?
    I use the demo provided by the WTK2.5-Beta(NetworkDemo), it works well in the simulator. However, when I download the program to the mobile phone, it seems that the mobile phone that runs ServerSocket cannot create the socket ... all the 2 handsets use a 3G SIM card provided by a Hong Kong ISP smartTone ... What can I do?
    Please help~ provide any web page of codes, thanks very much!

    1.     We want to create a socket connection which can
    remain open and live for ever till it is closed. Is
    this possible in java socket programming?Yes, but it isn't practical in the real networking world. So your code had better be prepared to deal with network failures.
    2.     I am just wondering in order to communicate with
    the third party over the socket connection, does this
    other party requires to run something specific on
    their end? I am not able to understand how will my
    java code communicate with their server otherwise.It has nothing to do with java. Sockets send and recieve messages. The applications at either end, regardless of the language that they are written in, must handle those messages.
    3.     Can we send and receive data over the socket
    created and also is their specific format for the
    data? Yes.
    Can we send files of data over this connection?Yes. (Although I don't know why you would need to do that if you are doing credit card auths.)
    It would be great if someone can comment on these
    questions and also if possible please provide some
    code that can create socket connection.The tutorial.....
    http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

  • Can i run UDP  client and UDP  server socket program in the same pc ?

    hi all.
    when i execute my UDP client socket program and UDP server socket program in the same pc ,
    It's will shown the error msg :
    "Address already in use: Cannot bind"
    but if i run UDP client socket program in the remote pc and UDP server socket program run in local pc , it's will success.
    anybody know what's going on ?
    any help will be appreciated !

    bobby92 wrote:
    i have use a specified port for UDP server side , and for client define the server port "DatagramSocket clientSocket= new DatagramSocket(Server_PORT);"Why? The port you provide here is not the target port. It's the local port you listen on. That's only necessary when you want other hosts to connect to you (i.e. when you're acting as a server).
    The server should be using that constructor, the client should not be specifying a port.
    so when i start the udp server code to listen in local pc , then when i start UDP client code in local pc ,i will get the error "Address already in use: Cannot bind"Because your client tries to bind to the same port that the server already bound to.

Maybe you are looking for

  • Material Master Default Values

    Dear All Whenever we create a material, we want to have the same value as default for a particular field in one of the Material master views. Is this possible and how can it be done? Regards Hary

  • Ati mobility x1400 drivers

    Screen freezes,need updated drivers. ati catalyst, hydravision radeon mobility x1400 lenovo t 60 thinkpad 8743-CTO win XP Pro. Message Edited by macs1944 on 09-05-2008 04:38 PM

  • Cisco Prime Server Specifications

    Would anyone happen to know a good server build would be to run Cisco Prime Infrastructure for 5k in network devices.  I can only find VM information and not physcial hardware specifications in regards to this.

  • Can 'Acknowledgmentcontains applic. errors' ALEAUD01 be caught by CCMS?

    We are using 4.6c with XI 3.0 and SUS 3.0.  If we send a purchase order to SUS and the document maps successfully in XI (XML Message Status 'successfully processed' in SXMB_MONI), but the Ack Status contains errors, we cannot generate a CCMS alert. S

  • Where are subtitles saved?

    Hi All, I'm working on a DVD of HMS Pinafore for a client of mine (School) and have been asked to add subtitles to the DVD so that people can sing along. I manually entered the entire libretto as subtitles. I spent 2 days entering the subtitles ...an