Error in socket streaming

Hi to all,
I develop an application in which server(computer) and client (mobile) interact with each other. I run that code on the emulator it works fine.
But on the device (6681) it didn't works..
code is:
Server: mobile_server.cpp
Header File Included
#include "server_class.cpp"
#include <winsock2.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <process.h>
using namespace std;
char buff[200];
int main()
Creating Socket remotesocket1 on the port 5000.
printf("accepting from mobile");
remotesocket1=Accept_Client_Connection(); // Accept Connection from client
printf("accepting from mobile");
printf("\n\t Sending.......");
// Send data to mobile
send( remotesocket, send_data, strlen(send_data), 0 );
//data send successfully to mobile
sz = recv( remotesocket, rec, sizeof(rec), 0 );
// This function blocks and doesn't work
send( remotesocket, send_data, strlen(send_data), 0 );
//data send successfully to mobile
sz = recv( remotesocket, rec, sizeof(rec), 0 );
closesocket(remotesocket1);
return 0;
Client..........
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import java.io.*;
public class socket extends MIDlet
// StreamConnection allows bidirectional communication
private StreamConnection streamConnection = null;
// use OutputStream to send requests
private OutputStream outputStream = null;
private DataOutputStream dataOutputStream = null;
// use InputStream to receive responses from Web server
private InputStream inputStream = null;
private DataInputStream dataInputStream = null;
// specify the connect string
private String connectString = "socket://219.91.231.122:5000";
// use a StrignBuffer to store the retrieved page contents
private StringBuffer results;
private StringBuffer results_size;
private StringBuffer ImgData;
private String size;
Image im = null;
// define GUI components
private Display myDisplay = null;
private Form resultScreen;
private StringItem resultField;
private Form resultScreen1;
public socket()
// initializing GUI display
results = new StringBuffer();
results_size = new StringBuffer();
ImgData=new StringBuffer();
myDisplay = Display.getDisplay(this);
resultScreen = new Form("test:");
public void startApp()
try {
// establish a socket connection with remote server
System.out.println("Wating for connection ........");
streamConnection =(StreamConnection) Connector.open(connectString);
System.out.println("connection Established........");
inputStream = streamConnection.openInputStream();
dataInputStream = new DataInputStream(inputStream);
outputStream = streamConnection.openOutputStream();
int inputChar;
while (true)
inputChar = dataInputStream.read();
if(inputChar=='d')
{           break;              }
results.append((char) inputChar);
resultScreen.append("r");
resultScreen.append(results.toString());
myDisplay.setCurrent(resultScreen);
resultScreen.append("sending ack........");
myDisplay.setCurrent(resultScreen);
outputStream.write("OK".getBytes());
resultScreen.append("sending ack........ snded");
myDisplay.setCurrent(resultScreen);
resultScreen.append("reading................");
while ( true )
resultScreen.append("reading");
myDisplay.setCurrent(resultScreen);
// Upto this it works fine...........................
inputChar = dataInputStream.read();
if(inputChar=='d')
{      break;                  }
results.append((char) inputChar);
resultScreen.append("r");
resultScreen.append(results.toString());
myDisplay.setCurrent(resultScreen);
outputStream.write("OK".getBytes());
resultField = new StringItem(null, results.toString());
//resultScreen.append(resultField);
myDisplay.setCurrent(resultScreen);
} catch (IOException e)
System.err.println("Exception caught:" + e);
} finally {
// free up I/O streams and close the socket connection
try {
if (dataInputStream != null)
dataInputStream.close();
} catch (Exception ignored) {}
try {
if (dataOutputStream != null)
dataOutputStream.close();
} catch (Exception ignored) {}
try {
if (outputStream != null)
outputStream.close();
} catch (Exception ignored) {}
try {
if (inputStream != null)
inputStream.close();
} catch (Exception ignored) {}
try {
if (streamConnection != null)
streamConnection.close();
} catch (Exception ignored) {}
public void pauseApp() {
public void destroyApp(boolean unconditional) {
}

hi, i newbie in java and still learning. can anyone help me. i'll try to run examples for the java sun websites in the tutorial. i can run the server program but when i'll run the client program. the output said uknown host. what should i do? please reply as soon as possible. thank you :).
i run server then client program like the tutorial said.
thank you

Similar Messages

  • Logical error with Sockets, not closing properly

    Hi again everybody, I am still in need of help it seems. I have been working on a way to transfer files from computer a to computer b but I cannot get the Sockets/Streams to work properly!
    The problem I keep getting is "IOException: java.net.SocketException: Software caused connection abort: socket write error"
    According to some threads in this forum its either because of a firewall blocking or because of an error such as the client trying to write to a stream that is closed in the other end ( or something like that, I cannot remember 100%).
    The thing is: I am only getting this the second time I try to send the file, the first time it works just fine.
    I can solve the problem by restarting the server (resetting the socket) after every time I send the file but that is not a solution, but merely a confirmation that I indeed have a bug.
    Can you please have a look at my code and point out where I missed something? I have been staring blindly at the code on and off for over a day now.
    CLIENT:
    import java.io.*;
    import java.net.*;
    * This is the FileSender class
    * Final version will take a File and Socket pointer
    * and send the file over the socket using the according handshake-protocol.
    * Current version opens it's own socket and can only send one File.
    * parameters:
    *  // File myFile, Socket mySocket <-- Final version goal
    *  String[] args  ()
    * @author Glader
    *     @version 1.2
    public class FileSender {
         private static Socket clientSocket = null;
    //     private static DataOutputStream output; <-- ver 1.0
         private static ObjectOutputStream output = null;
         private static FileInputStream file;
         private static BufferedReader input = null;
         private static final boolean DEBUG = true;
          * @param args
         public static void main(String[] args) {  // NOTE: REBUILD BEFORE FINAL!!!
              if(args.length != 1){
    //               throw new IllegalArgumentException("Error in FileSender: recieved " + args.length + " arguments, expected 2.");
                   System.err.println("Usage: Provide the method with ONE valid filepath/filename");
              else{
                   try{
                        if(DEBUG){ // <--- DEBUG BLOCK
                             if(input != null)
                                  System.out.println("input was not null at beginning of runtime!");
                             if(output != null)
                                  System.out.println("output was not null at beginning of runtime!");
                             if(clientSocket != null)
                                  System.out.println("clientSocket was not null at beginning of runtime!");
                   file = new FileInputStream(args[0]);
                   if(DEBUG){ // <---- DEBUG BLOCK
                        System.out.println("The following argument was entered: " + args[0]);
                             File myFile = new File(args[0]);
                             String sizeString = "";
                             long fileLength = myFile.length();
                             if(fileLength == 0){ // The file does not exist
                                  sizeString = "File does not exist";
                             }else if((fileLength / 1048576) != 0){ // The file is larger than 1Mb
                                  sizeString = "Filesize: " + (fileLength / 1048576) + " Mb";
                             }else if((fileLength / 1024) != 0){ // The file is larger than 1Kb
                                  sizeString = "Filesize: " + (fileLength / 1024) + " Kb";
                             }else{ // The file is larger than 1b
                                  sizeString = "Filesize: " + fileLength + " b";
                             System.out.println(sizeString);
                   send(file);
                   try{
                   input.close();
                   output.close();
                   clientSocket.close();
                   file.close();
                   }catch(IOException e){
                   catch(FileNotFoundException ex){
                        System.err.println("Error: No file was found at " + args[0] + " Double-check and try again.");
                   }finally{
                        try{
                        file.close();
                        }catch(IOException e){
                             //Nothing we can do
               * Send method
              private static void send(FileInputStream inFile){
              try{
                   clientSocket = new Socket("192.168.0.167", 2345);  //open a socket
                   input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // read what the server is saying
                   output = new ObjectOutputStream(clientSocket.getOutputStream());
                   if(DEBUG){  // <----- DEBUG BLOCK
                        String debugString = "";
                        if(input == null)
                             debugString += "input is null";
                        if(debugString.length() != 0)
                             debugString += ", ";
                        if(output == null)
                             debugString += "output is null";
                        if(debugString.length() == 0)
                             debugString += "input & output are OK";
                        System.out.println("status at start of 'send'-method: " + debugString);
                   if(clientSocket != null && inFile != null){
                        try{
                             long currentTime = System.currentTimeMillis();
                             boolean finished = false;
                             int flushTicker = 0;
                             int packetTicker = 0;
                             if(DEBUG){ // <--- DEBUG BLOCK
                                  System.out.println("packet-counter at " + packetTicker + " before sending data");
                             while(!finished){
                                  byte[] buffer = new byte[1024];
                                       if(flushTicker % 100 == 0) // clear cache, prevents OutOfMemory error
                                            output.reset();
                                       flushTicker++;
                                       packetTicker++;
                                       int bytesRead = inFile.read(buffer);
                                       if(bytesRead == -1){
                                            output.writeObject(new Packet(null, "finished", false, bytesRead));
                                            finished = true;
                                            output.flush();
                                       output.writeObject(new Packet(buffer, "", true, bytesRead));
                                       output.flush();
                             if(DEBUG) // <--- DEBUG BLOCK
                                  System.out.println("Number of packets sent: " + packetTicker);
                                  if(DEBUG){ // <---- DEBUG BLOCK
                                       // System.out.println("buffer contains: " + buffer.length + " bytes");
                                  long time = 0;
                                       if(DEBUG){
                                            time = ((System.currentTimeMillis() - currentTime)/1000);
                                       if(time == 0){// The operation took a very short time, cannot measure in seconds
                                            System.out.println("The operation took ~" + (System.currentTimeMillis() - currentTime) + " ms");
                                       }else{
                                       System.out.println( "The operation took " + time + " Seconds");
                             catch(UnknownHostException e){
                                  System.err.println("Trying to connect to unknown host: " + e);
                             catch(IOException e){
                                  System.err.println("IOException: " + e);
                   else{ // SOCKET OR FILE WERE NULL!
                        String result = "";
                        if(clientSocket == null){
                             result += "socket";
                        }else if(output == null){
                             result += "output";
                        }else if(input == null){
                             result += "input";
                        System.out.println("Error occured, " + result + " was null.");
              catch(UnknownHostException e){
                   System.err.println("Couldn't find the host");
                   try{
                   clientSocket.close();
                   }catch(IOException io){
                        //Nothing left to do
              catch(IOException e){
                   System.err.println("Couldn't get I/O from the connection");
              finally{
                   try{
                        if(clientSocket != null)
                             clientSocket.close();
                   }catch(IOException e){
                        //Nothing we can do
    }SERVER:
    import java.io.*;
    import java.net.ServerSocket;
    import java.net.Socket;
    * This is the main class for listening to incoming connections
    * It listens to an incoming ObjectInputStream and is able to
    * follow user-specified commands to execute various methods.
    * @author Glader
    * @version 1.1
    public class FileListener {
         static Socket incoming = null; // Socket connection with the client
         static ServerSocket ss = null;
         static ObjectInputStream is; // Data recieved from the connection
         static OutputStream out = null; // talk back to the client
         static FileOutputStream fout;
         static String response;
         private static final boolean DEBUG = true;
          * @param args
         public static void main(String[] args) {
              int port = 2345;
              boolean finished = false;
              while(true){
                   try{ // Establish server socket
                        ss = new ServerSocket(port);
                        }catch(IOException e){
              try{ // Wait for a client to connect
                   incoming = ss.accept();
                   if(DEBUG){ // <--- DEBUG BLOCK
                        if(ss != null)
                             System.out.println("ObjectInputStream initialized");
                   try{ // Read Objects from the incoming Stream
                   is = new ObjectInputStream(incoming.getInputStream());
                   fout = new FileOutputStream(new File("min fil.avi"));
                   int packetTicker = 0;
                   while(!finished){ // read until there are no more packets incoming
                   Packet currentPacket = (Packet) is.readObject();
                   packetTicker++;               
                   String command = currentPacket.getCommand();
                   if(command.length() != 0){ // The client is telling us something
                        // Insert a checking loop for all possible commands from the client here
                        if(command.equals("initiating")){
                             OutputStream out = incoming.getOutputStream();
                             out.write(10); // 10 signals that the client is cleared to send.
                        if(command.equals("finished")){
                             finished = true;
                             if(DEBUG){ // <--- DEBUG BLOCK
                             System.out.println("Connection terminated, client said \"" + command + "\"");
                             System.out.println("Total amount of packets recieved: " + packetTicker);
                   if(currentPacket.containsFileData()){
                        if(currentPacket.amountOfData() == -1)
                             finished = true;
                        if(currentPacket.amountOfData() != 1024){ // Special handling for not entirely full packets
                                  fout.write(currentPacket.getFileData(), 0, currentPacket.amountOfData());
                        }else{
                        fout.write(currentPacket.getFileData());
                   fout.close();
                   is.close();
                   incoming.close();
                   catch(ClassNotFoundException ex){
                        System.err.println("Error when reading Packet: " + ex);
                   finally{
                        if(fout != null){
                             fout.close();
                        }if(is != null){
                             is.close();
                        }if(incoming != null){
                             incoming.close();
                        }if(out != null)
                             out.close();
              catch (IOException ex){
                   System.err.println("Error getting inputStream");
         

    Follow-up question, need more information to solve the problem:
    My server now uses a ObjectOutputStream to send packets to the client, which successfully reads them BUT:
    the problem still remains! I am still getting a "SocketException socket write error" the second time I use the sender!
    Right now this is what the send-method in FileSender looks like.
    (Look at "// Connection Loop" for the biggest change.)
    What am I doing wrong here?
              private static void send(FileInputStream inFile){
                   if(DEBUG) // <--- DEBUG BLOCK
                        System.out.println("Flag reached: Beginning of \"send\"");
              try{
                   clientSocket = new Socket("192.168.0.167", 2345);  //open a socket
                   output = new ObjectOutputStream(clientSocket.getOutputStream()); // Outgoing Packets to the server
                   if(DEBUG){  // <----- DEBUG BLOCK
                        String debugString = "";
                        if(input == null)
                             debugString += "input is null";  // Expected with current code
                        if(debugString.length() != 0)
                             debugString += ", ";
                        if(output == null)
                             debugString += "output is null";
                        if(debugString.length() == 0)
                             debugString += "input & output are OK";
                        System.out.println("status at start of 'send'-method: " + debugString);
                   if(clientSocket != null && inFile != null){
                        try{
                             long currentTime = System.currentTimeMillis();
                             boolean finished = false;
                             boolean accepted = false;
                             int flushTicker = 0;
                             int packetTicker = 0;
                             // Connection loop with 500ms timeout
                             input = new ObjectInputStream(clientSocket.getInputStream()); // Incoming Packets from the server
                             while((System.currentTimeMillis() - currentTime) <= 500){ // try connecting for 500ms
                                  output.writeObject(new Packet(null, "initiating", false, 0)); // send the first request Packet
                                  try{
                                  Packet currentPacket = (Packet) input.readObject();
                                  String command = currentPacket.getCommand();
                                  if(DEBUG) // <--- DEBUG BLOCK
                                       System.out.println("Command sent from Server: " + command);
                                  if(command.equals("ready")){
                                       accepted = true;
                                  if(accepted){
                             while(!finished){
                                  byte[] buffer = new byte[1024];
                                       if(flushTicker % 100 == 0) // clear cache, prevents OutOfMemory error
                                            output.reset();
                                       flushTicker++;
                                       packetTicker++;
                                       int bytesRead = inFile.read(buffer);
                                       if(bytesRead == -1){
                                            output.writeObject(new Packet(null, "finished", false, bytesRead));
                                            finished = true;
                                            output.flush();
                                       output.writeObject(new Packet(buffer, "", true, bytesRead));
                                       output.flush();
                             catch(ClassNotFoundException e){
                                  System.err.println("ClassNotFoundException: " + e);
                                  while(bytesRead != -1){
                                  if(DEBUG) // <--- DEBUG BLOCK
                                       System.out.println("bytesRead: " + bytesRead);
                                  else{
                                  output.writeObject(new Packet(buffer, "", true));
                                  flushTicker++;
                                  if(bytesRead == -1){ // no more bytes to be read from the file
                                  long time = 0;
                                       if(DEBUG){
                                            System.out.println("Number of packets sent: " + packetTicker);
                                            time = ((System.currentTimeMillis() - currentTime)/1000);
                                       if(time == 0){// The operation took a very short time, cannot measure in seconds
                                            System.out.println("The operation took ~" + (System.currentTimeMillis() - currentTime) + " ms");
                                       }else{
                                       System.out.println( "The operation took " + time + " Seconds");
                             catch(UnknownHostException e){
                                  System.err.println("Trying to connect to unknown host: " + e);
                             catch(IOException e){
                                  System.err.println("IOException: " + e);
                   else{ // SOCKET OR FILE WERE NULL!
                        String result = "";
                        if(clientSocket == null){
                             result += "socket";
                        }else if(output == null){
                             result += "output";
                        }else if(input == null){
                             result += "input";
                        System.out.println("Error occured, " + result + " was null.");
              catch(UnknownHostException e){
                   System.err.println("Couldn't find the host");
                   try{
                   clientSocket.close();
                   }catch(IOException io){
                        //Nothing left to do
              catch(IOException e){
                   System.err.println("Couldn't get I/O from the connection");
              finally{
                   try{
                        if(clientSocket != null)
                             clientSocket.close();
                   }catch(IOException e){
                        //Nothing we can do
              }

  • Java socket streams messing up

    iv wrote a games server and it uses java socket streams to send the messages back and forth between the game clients and the game server it self
    this all works great but when running and over about 5min its send over 1000 packets BUT
    it will crash iv found the reason is down to when reading the packets my parser is reading wrong part and grabbing a String part when it should be a INT
    now it should NEVER be reading this part of the packet so i put a trace on the packets coming in and ran it every packet was been read in perfect THEN just befor the crash TWO packets were merged together stright out from the socket stream this is y my packet reader was getting confused
    what im asking is can this happen in java sockets ? i thought they were bufferered so no matter how fast you send data it would always read it out in the same order ?? not sure how its merging these to packets
    is this possible of is my reader got an error in it altho works 95% of the time ??

    or do you have multiple buffered streams created from the same socket?

  • Problem trying to read an SSL server socket stream using readByte().

    Hi I'm trying to read an SSL server socket stream using readByte(). I need to use readByte() because my program acts an LDAP proxy (receives LDAP messages from an LDAP client then passes them onto an actual LDAP server. It works fine with normal LDAP data streams but once an SSL data stream is introduced, readByte just hangs! Here is my code.....
    help!!! anyone?... anyone?
    1. SSL Socket is first read into  " InputStream input"
    public void     run()
              Authorization     auth = new Authorization();
              try     {
                   InputStream     input     =     client.getInputStream();
                   while     (true)
                   {     StandLdapCommand command;
                        try
                             command = new StandLdapCommand(input);
                             Authorization     t = command.get_auth();
                             if (t != null )
                                  auth = t;
                        catch( SocketException e )
                        {     // If socket error, drop the connection
                             Message.Info( "Client connection closed: " + e );
                             close( e );
                             break;
                        catch( EOFException e )
                        {     // If socket error, drop the connection
                             Message.Info( "Client connection close: " + e );
                             close( e );
                             break;
                        catch( Exception e )
                             //Way too many of these to trace them!
                             Message.Error( "Command not processed due to exception");
                             close( e );
                                            break;
                                            //continue;
                        processor.processBefore(auth,     command);
                                    try
                                      Thread.sleep(40); //yield to other threads
                                    catch(InterruptedException ie) {}
              catch     (Exception e)
                   close(e);
    2 Then data is sent to an intermediate function 
    from this statement in the function above:   command = new StandLdapCommand(input);
         public StandLdapCommand(InputStream     in)     throws IOException
              message     =     LDAPMessage.receive(in);
              analyze();
    Then finally, the read function where it hangs at  "int tag = (int)din.readByte(); "
    public static LDAPMessage receive(InputStream is) throws IOException
        *  LDAP Message Format =
        *      1.  LBER_SEQUENCE                           --  1 byte
        *      2.  Length                                  --  variable length     = 3 + 4 + 5 ....
        *      3.  ID                                      --  variable length
        *      4.  LDAP_REQ_msg                            --  1 byte
        *      5.  Message specific structure              --  variable length
        DataInputStream din = new DataInputStream(is);
           int tag = (int)din.readByte();      // sequence tag// sequence tag

    I suspect you are actually getting an Exception and not tracing the cause properly and then doing a sleep and then getting another Exception. Never ever catch an exception without tracing what it actually is somewhere.
    Also I don't know what the sleep is supposed to be for. You will block in readByte() until something comes in, and that should be enough yielding for anybody. The sleep is just literally a waste of time.

  • Problems reading  an SSL server socket stream using readByte()

    Hi I'm trying to read an SSL server socket stream using readByte(). I need to use readByte() because my program acts an LDAP proxy (receives LDAP messages from an LDAP client then passes them onto an actual LDAP server. It works fine with normal LDAP data streams but once an SSL data stream is introduced, readByte just hangs! Here is my code.....
    help!!! anyone?... anyone?
    1. SSL Socket is first read into  " InputStream input"
    public void     run()
              Authorization     auth = new Authorization();
              try     {
                   InputStream     input     =     client.getInputStream();
                   while     (true)
                   {     StandLdapCommand command;
                        try
                             command = new StandLdapCommand(input);
                             Authorization     t = command.get_auth();
                             if (t != null )
                                  auth = t;
                        catch( SocketException e )
                        {     // If socket error, drop the connection
                             Message.Info( "Client connection closed: " + e );
                             close( e );
                             break;
                        catch( EOFException e )
                        {     // If socket error, drop the connection
                             Message.Info( "Client connection close: " + e );
                             close( e );
                             break;
                        catch( Exception e )
                             //Way too many of these to trace them!
                             Message.Error( "Command not processed due to exception");
                             close( e );
                                            break;
                                            //continue;
                        processor.processBefore(auth,     command);
                                    try
                                      Thread.sleep(40); //yield to other threads
                                    catch(InterruptedException ie) {}
              catch     (Exception e)
                   close(e);
    2 Then data is sent to an intermediate function 
    from this statement in the function above:   command = new StandLdapCommand(input);
         public StandLdapCommand(InputStream     in)     throws IOException
              message     =     LDAPMessage.receive(in);
              analyze();
    Then finally, the read function where it hangs at  "int tag = (int)din.readByte(); "
    public static LDAPMessage receive(InputStream is) throws IOException
        *  LDAP Message Format =
        *      1.  LBER_SEQUENCE                           --  1 byte
        *      2.  Length                                  --  variable length     = 3 + 4 + 5 ....
        *      3.  ID                                      --  variable length
        *      4.  LDAP_REQ_msg                            --  1 byte
        *      5.  Message specific structure              --  variable length
        DataInputStream din = new DataInputStream(is);
           int tag = (int)din.readByte();      // sequence tag// sequence tag

    I suspect you are actually getting an Exception and not tracing the cause properly and then doing a sleep and then getting another Exception. Never ever catch an exception without tracing what it actually is somewhere.
    Also I don't know what the sleep is supposed to be for. You will block in readByte() until something comes in, and that should be enough yielding for anybody. The sleep is just literally a waste of time.

  • Getting "Error Establishing Socket " error while running the application

    Hi,
    Can Any one help me as I getting the following error while inserting data into database for after some rows and will insert for some rows then again some error . I googled but but didnt get any proper solution.
    Soultion what I got it is
    1) turn off windows firewall.
    2) change server TCP/IP settings.
    3) It will give probelm with windows XP SP 2
    I tried all but didnt able to solve that.
    I am using Java 1.5, MSSQL server 2000,and eclipse 3.2,windows XP SP2
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.aztecsoft.quality.DatabaseConnectionQLTYSRV.getCon(DatabaseConnectionQLTYSRV.java:25)
    at com.aztecsoft.quality.DatabaseQuery.getDaytoCountRow(DatabaseQuery.java:147)
    at com.aztecsoft.quality.ProjectTrackerUtil.getNetworkDays(ProjectTrackerUtil.java:73)
    at com.aztecsoft.quality.ProjectPlan.calODurationinDays(ProjectPlan.java:81)
    at com.aztecsoft.quality.ProjectPlan.projectSummary(ProjectPlan.java:25)
    at com.aztecsoft.quality.ProjectPlan.main(ProjectPlan.java:126)
    Thanks in advance.

    Hi this is gopi,Hyd.Is your Problem "Getting "Error Establishing Socket " error while running the application" solved if so can you reply me i am waiting for this answer

  • Error in JDBC Adapter-"Error establishing socket"

    Hi,
    I am getting an error in the seander JDBC adapter. PFB the error:
    Error during database connection to the database URL 'jdbc:microsoft:sqlserver://Server Name;DatabaseName=DB Name;SelectMethod=cursor' using the JDBC driver 'com.microsoft.jdbc.sqlserver.SQLServerDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:microsoft:sqlserver://Server Name;DatabaseName=DB Name;SelectMethod=cursor': SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.'
    Can any one hlep me to resolve the error.
    Thanks,
    RK

    Hi,
    Also check whether you have given database connection parameters in the following format:
    JDBC Driver:
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection:   jdbc:microsoft:sqlserver://<HOSTNAME>:1433;DatabaseName=<xxxx>;SelectMethod=cursor
    I think the deployment is done, because you have not got "SAPClassNotFoundException" error.(If the deployment is not done, the driver file cant be located so this will be thrown...)
    Thanks & Regards,
    Senthil.

  • JDBC Communication channel : Error establishing socket

    Dear friends,
    Im using JDBC comm channel. JDBC driver has been insatlled for SQL Server 2000 (SP3) .
    However for the JDBC comm. channel i get an error
    "SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.'
    following parameters are used :
    JDBC driver:  com.microsoft.jdbc.sqlserver.SQLServerDriver
    DB connection :
    jdbc:microsoft:sqlserver://<ip address>:1433;databaseName=<dbname>
    i looked up some blogs in SDN, & tried some other options,
    eg: com.microsoft.sqlserver.jdbc.SQLServerDriver
    DB name:
    jdbc:microsoft:sqlserver://<ip address>:1433;DatabaseName=<dbname>
    However still get the same error
    Can somebody help ?

    Hi
    The following should fix your problem
    <i>I had this problem using SQLServer 2000 Driver for JDBC and finally solved it. Here's what I did:
    1. Make sure that SQL Server is set to mixed authentication. To do this, open enterprise manager, right click on server/properties; go to security tab and select SQL Server and Windows Authentication. Apparently, the driver from Microsoft cannot handle windows integrated authentication.
    2. Keeping the server properties dialog up, go to the general tab and push the network configuration button. <b>Enable TCP/IP (it is disabled by default). If you wish, press properties to change the default port (1433).</b>
    3. Add an SQL Server login account (NOT a WINDOWS account (see 1)). You can also use your sa account, but I don't recommend it.
    4. Use the login setup in step 3.
    Some final notes:
    (1) I've seen ads for third party drivers that can use Windows integrated authentication. Try one if you need this feature.
    (2) One responder suggested telneting to port 1433 to verify TCP connectivity. The connection is refused on my machine even though I can connect through the driver. And this is how it should be; otherwise there'd be a security risk.</i>
    Courtesy:XI installation Configuration of J2EE engine problem
    Regards
    krishna
    <i>Note:Reward points if helpful</i>

  • "Error establishing socket" error on JDBC Receiver Channel.

    Dear All,
    Scenario: Soap to JDBC.
    I m getting error on JDBC Receiver Channel. messages are processed succesfully on ABAP Stack and receiver channel is on below error:
    ERROR : Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error when attempting to get processing resources: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL 'jdbc:microsoft:sqlserver://156.5.202.194:3312;DatabaseName=ODW': SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    Note: i already tested another interface with this same IP and it was fine with different port.
    jdbc:microsoft:sqlserver://IP:PORT;DatabaseName=Name
    Regards,
    Manikandan

    and it was fine with different port
    socket exception is (always) related to port....did you check with the network team about this new Port?

  • Error Establishing Socket jdbc

    hello guys i have the problem of error establishing socket in tomacat 4.0.1 and i am using sqlserver 2000.My Application works well for n number of users but then application server hangs giving the "error establishing socket".
    i am closing all the statements and i am calling connection object in init() and closing it in destoy(). And I am not using connection pooling.
    please specify the changes needed to work with SQL server connection with jdbc
    do help me guys its urgent for me
    tell me as soon as possible.

    hello guys i have the problem of error establishing
    socket in tomacat 4.0.1 and i am using sqlserver
    2000.My Application works well for n number of users
    but then application server hangs giving the "error
    establishing socket".
    i am closing all the statements and i am calling
    connection object in init() and closing it in
    destoy(). And I am not using connection pooling.
    please specify the changes needed to work with SQL
    server connection with jdbc
    do help me guys its urgent for me
    tell me as soon as possible. sql server and windows are terrible under load. i know this from
    personal experience ahving spent a great deal of time fixing an ASP site
    that used ADO to access SQL Server 2000. what happens eventually with
    windows and sql server is that when the server gets really busy the os
    does not prioritize itself very well and you can run out of sockets
    temporarily because even though you have programmtically released them
    the operating system is still holding on to them.
    part of the solution i used was to use pooled connections. i suggest the
    same for you.

  • Error establishing socket to host and port: EPM11:1433

    Hi Planning Experts,
    I am trying to configure EPM 11.1.2.1 (Planning)
    RDBMS: SQL server 2005 (Express Edition)
    OS: 2008 R2 x64
    i am getting error after providing RDBMS credentials "error establishing socket to host and port: EPM11:1433 Reson: connection refused: connect"
    Please help....
    Regards
    Kumar

    You may need to enable tcp/ip
    SQL Server Express listens on local named pipes and shared memory. With a default installation, you cannot remotely connect to SQL Server Express. You will need to enable TCP/IP and check if the firewall is enabled.
    To enable TCP/IP:
    From the Start menu, choose All Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Configuration Manager.
    Optionally, you can open Computer Manager by right-clicking My Computer and choosing Manage. In Computer Management, expand Services and Applications, expand SQL Server Configuration Manager.
    Expand SQL Server 2005 Network Configuration, and then click Protocols for InstanceName.
    In the list of protocols, right-click the protocol you want to enable, and then click Enable.
    The icon for the protocol will change to show that the protocol is enabled.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • 'Error establishing socket' due to too many TCP sockets

    Hallo
    I have an app running on Win 2000, SP 3, JRE 1.2, connecting with a MSSQL 2000 DB using MS JDBC drivers and constantly writing updates to this DB. It starts off fine and continues for quite some time before encountering the following exception:
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing socket.
    Checking the output from netstat while the application is running revealed a huge number of sockets which are aparently used by the application since closing the application causes all these connections to be closed. I assumed that this may be the cause of the exception.
    The application only connects with the database once and statements and resultsets are closed after use.
    The same application running at other sites with more-or-less the same environment does not cause as many open sockets.
    Can anybody tell why so manu sockets are created and not closed ? Any suggestions will be much appreciated.
    Regards
    Dawie

    As an update, I was using connection pooling, and removed it. Now I create a connection per request and explicitly close the connection when done. This accomplished two things, reduced the number of stale connections, and also "throttled" down the process somewhat (not by much as in testing I found the average response times slowed by only a couple milliseconds).
    I did do a netstat on the application server when I started receiving all the errors and found, like dawiemoller did, there was a VERY large number of stale connections to the SQL 2000 server. I wasn't able to telnet into the SQL server and port, as expected. Restarting the Java app on the application server cleared up all the stale connections.
    After I removed the connection pooling, I've yet to receive the "error establishing socket" error, however after checking netstat again, I did find that there are still a lot of stale connections, just not nearly as many.
    If this is a Microsoft bug, why would the stale connections go away after restarting the Java Application? Microsoft IIS is also running on the same server with database access to the SQL 2000 server and it isn't having any trouble. Could it be just a combination of this "bug" and using Microsoft's JDBC driver (SP1) to SQL 2000? Would switching to another vendors JDBC driver avoid this problem?
    Scott Reynolds

  • SQL Server 2000 Driver for JDBC - Error establishing sockets

    Hi there
    I am using Microsoft SQL Server 2000 Driver for JDBC to connect to SQL Sever 2000. It is just a test application to see if it would connect to the datacase successfully. But I got the following errors. I already set up the classpath and installed all SQL Server 2000 Driver for JDBC sp 3. Dont know why it still failed...can anyone help me out of this? Thanks.
    When i am using simple JDBC-ODBC bridge Driver it's working fine.
    For this Server Pack3 , i have checked every thing like--
    TCP / IP Poart is Enable.
    I am working in client machine, my MSSQLServer 2000 Placed in server Machine.
    when i am giving Telnet ServerIP 1433 it's giving following response.
    connecting to ServerIP ....... could not open connection to the host , on port 1433:connection Failed
    My Sample Code is :--
    String user="sa";
    String password="imcindia";
    Connection con1 = null;
    CallableStatement cstmt = null;
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
    con1=DriverManager.getConnection("jdbc:microsoft:sqlserver://ServerName:1433;DatabaseName=dmo1o2d",user,password);
    Statement st=con1.createStatement();
    st.execute("use dm0102d");
    st.execute("setuser 'dm01012'");
    cstmt = con1.prepareCall("{?=Call dms_ex_create_folder('ABC','18753','NB21','u')}");
    cstmt.execute();
    Here are Error Code :
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
         at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
         at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
         at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
         at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
         at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection refused: connect
         at java.sql.DriverManager.getConnection(Unknown Source)
         at TestConnection1.main(TestConnection1.java:24)
    one can help me to over come this problm,
    Thanks in advance.
    venkat

    hey i also have this problem i have been looking for solution for this problem for along time i tried every possible solution i tried every service pack for the SQL but it didn't connect to the port!!!
    it's a network problem ur java code is correct dont worry about it.
    finally i had to install MySQL and it's work fine now but if u insist on usning SQL u have to use the JDBC-ODBC Bridge it will work by :
    first add data source database , follow these steps
    1- go to Administrative tools
    2-Data Sources(ODBC)
    3-System DNS tab and add then choose SQL SERVER the last option then finish
    4-write the name; Note: this name is the one that u will write in ur URL for example if u write Hello the URL will be "jdbc:odbc:Hello"
    5- choose the server, its recommended to write "." or (local)
    6-change the database to its an important step to choose the database that u want to use, choose northwind if u want to use it
    finish
    second
    adding this code:
    import java.sql.*;
    class JdbcTest1 { 
    public static void main (String[] args) { 
    try { 
    // Step 1: Load the JDBC driver.
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // Step 2: Establish the connection to the database.
    String url = "jdbc:odbc:Hello";
    Connection conn = DriverManager.getConnection(url,"user1","password");
    } catch (Exception e) { 
    System.err.println("Got an exception! ");
    System.err.println(e.getMessage());
    it will work without any problems

  • Error establishing socket (Microsoft SQL Server 2000 Driver for JDBC)

    I tray connect to MS-SQL2000 using JDeveloper and retrieve an error: "[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.[Microsoft][SQLServer 2000 Driver for JDBC]PC160832\NCI_DBA_01"
    I followed the steps:
    1 - Install the JDBC Driver for MS-SQL2000
    2 - Create a new AddJavaLibPath :"AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib"
    3 - Specify Default Project Libraries: "msbase.jar, msutil.jar and mssqlserver.jar"
    4 - Create a new connection: "Java class name: com.microsoft.jdbc.sqlserver.SQLServerDriver" "URL: jdbc:microsoft:sqlserver://PC160832\NCI_DBA_01:1433;SelectMethod=cursor"
    5 - Retrieve the error: "[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.[Microsoft][SQLServer 2000 Driver for JDBC]PC160832\NCI_DBA_01"

    Were you able to resolve this? If so could you tell me how. I have the same problem.
    Thanks!!!

  • JDBC Error Establishing Socket

    Hi, I've a problem with my JDBC connection to the SQL Server Database in my Java file. I got a "Error Establishing Socket" problem when I tried to access a database in another server. Can someone tell me what are the possible causes?

    firewall... server not running... etc etc

Maybe you are looking for

  • Dual Booting with second hard drive

    Okay so I just ordered an enclosure to replace my optical drive with my old HDD. I have already put an SSD where the old HDD was and I could really use some more storage space for video projects. Also, I want to dual boot Ubuntu on this machine. I am

  • RGB color in inDesign changes (washed out) after exporting it to PDF

    Hi, I am new to InDesign and i have a hard time figuring out how could I export my InDesign file to PDF without affecting the color. This is what I do. 1. I created a new document with Transparency Blend Space set to Document RGB 2. I created a box u

  • Ipod Wont get off apple screen!

    Hi, My main problem with my ipod mini is that its fully charged and when i turn it on it wont get off the apple screen. It stays on there for like 5 - 10 seconds and makes a clicking noise and shuts off and then restarts and does it again. I cant eve

  • New Install - Best Way to add users

    Hi, Disclaimer: 100% New to Macs! I need advice on setting up a new Mac Mini Server. Our intent is to use this as an e-mail/calendar server for a small business, replacing a Lotus Domino server that is being retired. Our computing enviroment is based

  • Can't edit duration of audio or photos

    Hi, I need your help! I've imported an audio clip and an image. I'm trying to make a video that's the duration of the audio clip with the image comprising the only visual that lasts throughout. I select the clips, hit the "Adjust" button, then hit th