address already in use


 
Thread Tools Search this Thread
Operating Systems SCO address already in use
# 1  
Old 07-20-2006
address already in use

The following code, when run under Linux (any variant) runs fine, but when I run it under SCO Openserver 5.0.7 i get an "address already in use" error. I had resoved this issue some time ago by doing something and now i do not recall. I have already confirmed the port 5510 is not in use by any process in the system at any time. Any information or advice would be greatly appreciated.

rmurtagh

CODE:

Code:
package javaclient;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.*;
import java.io.*;
import java.net.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPEnvelope;

public class getresv {

  public boolean execute() {
    boolean retBool = true;
    String xmlinput;
    String endpoint;
    try
    {
      System.out.print("\n\nStarted");
      ServerSocket welcomeSocket = new ServerSocket(5510);
      Socket connectionSocket = welcomeSocket.accept();
      System.out.print("\n\nServer has connected!");

      BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
      DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream());

      xmlinput = inFromClient.readLine();

      System.out.print("\n\nxml in: " + xmlinput);

      endpoint = inFromClient.readLine();

      System.out.print("\n\nendpoint: " + endpoint);

      StringBuffer xmlBuffer = new StringBuffer();
      xmlBuffer.append(xmlinput);
      
      ByteArrayInputStream byteIn = new ByteArrayInputStream(xmlBuffer.toString().getBytes());
      InputStream input = byteIn;

      SOAPEnvelope reqMsg = new SOAPEnvelope(input);
      String websrvendpt = endpoint;
      Service webService = new Service();
      Call call = (Call)webService.createCall();
      call.setTargetEndpointAddress(websrvendpt);
      call.setTimeout(new Integer(1000000));

      System.out.println("\n\nOutgoing:\n" + reqMsg);

      SOAPEnvelope xmlin = (SOAPEnvelope)call.invoke(reqMsg);
      String respMsg = xmlin.toString();

      System.out.println("\n\nIncoming:\n" + respMsg + "\n");
      
      outToClient.writeBytes(respMsg + '\n');

      Thread.sleep(1000);

      System.out.println("\n\nSent response to PMS...\n");

      connectionSocket.close();
      welcomeSocket.close();
    }
    catch (UnknownHostException ex) {
      System.out.println("\n\nUnknown Ssytem Error: " + ex.getMessage());
    }
    catch (Exception ex) {
      System.out.println("\n\nError: " + ex.getMessage());
    }
    return retBool;
  }

   public static void main(String[] args) throws Exception {
   boolean retBool = (new getresv()).execute();
  }
}


Last edited by reborg; 07-20-2006 at 12:31 PM.. Reason: code tags
# 2  
Old 07-20-2006
It appears that there is something already bound to port 5510. How did you confirm that there was not?

Another instance of your program still running, or some other service. You'll need to either change your port number or stop the other process which is bound to that port.
# 3  
Old 07-20-2006
There are no other instances of the program running.
I used netstat -an to determine the port was not in use.
Changing the port yields the same results using ports in the well known range but unused or in the ephemeral range if i run the program directly from the command prompt or from a script.

Code:
# netstat -an
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp        0      2  192.168.255.3.23       216.216.34.226.23015   ESTABLISHED
tcp        0      0  192.168.255.3.23       216.216.34.226.10797   ESTABLISHED
tcp        0      0  192.168.255.3.23       192.168.255.2.1110     ESTABLISHED
tcp        0      0  192.168.255.3.23       192.168.255.1.1097     ESTABLISHED
tcp        0      0  *.8457                 *.*                    LISTEN
tcp        0      0  *.615                  *.*                    LISTEN
tcp        0      0  *.80                   *.*                    LISTEN
tcp        0      0  *.587                  *.*                    LISTEN
tcp        0      0  *.25                   *.*                    LISTEN
tcp        0      0  *.*                    *.*                    CLOSED
tcp        0      0  *.801                  *.*                    LISTEN
tcp        0      0  *.1025                 *.*                    LISTEN
tcp        0      0  *.1024                 *.*                    LISTEN
tcp        0      0  *.22                   *.*                    LISTEN
tcp        0      0  *.199                  *.*                    LISTEN
tcp        0      0  *.143                  *.*                    LISTEN
tcp        0      0  *.110                  *.*                    LISTEN
tcp        0      0  *.37                   *.*                    LISTEN
tcp        0      0  *.13                   *.*                    LISTEN
tcp        0      0  *.19                   *.*                    LISTEN
tcp        0      0  *.9                    *.*                    LISTEN
tcp        0      0  *.7                    *.*                    LISTEN
tcp        0      0  *.1                    *.*                    LISTEN
tcp        0      0  *.79                   *.*                    LISTEN
tcp        0      0  *.512                  *.*                    LISTEN
tcp        0      0  *.513                  *.*                    LISTEN
tcp        0      0  *.514                  *.*                    LISTEN
tcp        0      0  *.23                   *.*                    LISTEN
tcp        0      0  *.21                   *.*                    LISTEN
tcp        0      0  *.111                  *.*                    LISTEN
udp        0      0  *.801                  *.*
udp        0      0  *.986                  *.*
udp        0      0  *.985                  *.*
udp        0      0  *.1066                 *.*
udp        0      0  *.1027                 *.*
udp        0      0  *.161                  *.*
udp        0      0  *.37                   *.*
udp        0      0  *.13                   *.*
udp        0      0  *.19                   *.*
udp        0      0  *.9                    *.*
udp        0      0  *.7                    *.*
udp        0      0  *.518                  *.*
udp        0      0  *.512                  *.*
udp        0      0  *.*                    *.*
udp        0      0  *.1026                 *.*
udp        0      0  *.1025                 *.*
udp        0      0  *.111                  *.*
udp        0      0  *.1024                 *.*
udp        0      0  *.488                  *.*
udp        0      0  *.*                    *.*
Active UNIX domain sockets
Address      Type       Recv-Q      Send-Q     Conn        Addr
fce2aac0     dgram           0           0 fce288b8
fce2abe0     dgram           0           0 fce288b8
fce28558     dgram           0           0 fce288b8
fce284c8     stream          0           0        0        /etc/egd-pool
fce2ac70     dgram           0           0 fce288b8
fce29ea8     dgram           0           0 fce288b8
fce28708     stream          0           0        0        /pmd/IPCST_pipe
fce28798     stream          0           0        0        /pmd/IPCCT_pipe
fce28828     dgram           0           0 fce288b8
fce288b8     dgram           0           0        0        /dev/syslog
#

# 4  
Old 07-20-2006
change
Code:
    catch (Exception ex) {
      System.out.println("\n\nError: " + ex.getMessage());
    }

to
Code:
    catch (Exception ex) {
      ex.printStackTrace();
    }

There may be something more useful than just the error message in the stacktrace.
# 5  
Old 07-20-2006
The results of your suggested change:

Code:
DB/C 14 IMAG10.2>cat java.error
java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:447)
        at java.net.ServerSocket.<init>(ServerSocket.java:165)
        at java.net.ServerSocket.<init>(ServerSocket.java:77)
        at javaclient.getresv.execute(getresv.java, Compiled Code)
        at javaclient.getresv.main(getresv.java:75)
DB/C 14 IMAG10.2>


Last edited by rmurtagh; 07-20-2006 at 01:18 PM..
# 6  
Old 07-20-2006
I started poking around the OS with other sockets that were in use and found some very odd errors. I relinked the kernel and rebooted and the error has gone away. Thank you for your time. I know it is as valuable to you as mine is to me.

(very nice forums btw - i noticed you edited my 1st post and assume you are at least a moderator)
# 7  
Old 07-20-2006
A good outcome.

Yes, I am a Mod here, the edit was just so the code came out correctly indented.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. IP Networking

MAC Address - Four Interfaces with the same MAC Address

four interfaces with ifconfig all interfaces have the same mac. If is not set for unique. but it still works. what difference does it make to have all macs the same or different? (4 Replies)
Discussion started by: rrodgers
4 Replies

2. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

3. IP Networking

Tracing a MAC address to IP address: Solaris

Hi there I lost connectivity to one of our remote systems and when I checked the messages log I found the following: Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1 Aug 16 13:20:51 host... (9 Replies)
Discussion started by: notreallyhere
9 Replies

4. UNIX for Dummies Questions & Answers

What would the physical address be for virtual address?

Hi guys, I got one problem which I definetily no idea. What would the physical address be for virtual address? 1) 2ABC 2) 3F4B Here is the page table:see attached Thank you sos sososososso much!! (0 Replies)
Discussion started by: lemon_06
0 Replies

5. Solaris

Get ip address from mac address

I have following message in my messages file on solaris 10 WARNING: e1000g3712000:3 has duplicate address 010.022.196.011 (in use by 00:50:56:85:25:ef); disabled Now is there any way i can find which server has 00:50:56:85:25:ef mac address either IP or Hostname ? (6 Replies)
Discussion started by: fugitive
6 Replies

6. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

7. Shell Programming and Scripting

ksh - how to list all ip address between 2 ip address

Trying to do a ksh script that needs to list all ip address between ip address a and b .. ie. Ip address A=192.168.1.200 Ip address B=192.168.2.15 So the subnet changes from 1 to 2 but I want to list all possible ip addresses between the 2.. Which would be: 192.168.1.200... (4 Replies)
Discussion started by: frustrated1
4 Replies

8. IP Networking

How to Achive IP address through MAC(Ethernet) address

Hi sir, i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address....... but i'm nt getting that how i can pass the MAC address to Frame........ Please give me an idea for making such program... Thanks & regards Krishna (3 Replies)
Discussion started by: krishnacins
3 Replies

9. UNIX for Dummies Questions & Answers

network address and broadcast address?

say I have a IP address which is 10.0.0.12, and subnet mask is 255.255.255.240, what is the network address and what is the broadcast address which host lives on? And could you explain how to get the answer? thanx in advance! (7 Replies)
Discussion started by: pnxi
7 Replies
Login or Register to Ask a Question