Creating a Listener

How do i go about creating my own customized listener classes? Like for example, i want to create a SocketListener to manage socket's properties (similiar to Winsock in VB) using events.

Take a look at how the AWT event listeners are implemented, it really simple:
First, make an interface having method declarations of those 'messages' you want your listener to receive.
Like eg. public interface SocketListener {
public void socketEvent1();
}Then, in your 'listener-server' i.e. you socket class, you add (at least) public class MySocket {
private Collection listeners = new List();
public void addListener(SocketListener listener) {
   listeners.add(listener);
} Whenever you want to send a message/notification, simply iterate through all listeners and call the event method//...
Iterator itListener = listeners.iterator();
while (itListener.hasNext())
   ((SocketListener)itListener.next()).socketEvent1();
//...Of course, it should be possible to remove a listener and you can also add return values as well as arguments to the methods.
Now, all the classes interrested in 'listening' to your Socket class, should implement the SocketListener interface and add themself to the Socket class...
This should do the trick :-)

Similar Messages

  • Creating a Listener on Another Machine (WebServer)

    Hi,
    How can I create a listener on a server without a database installed ?
    I have a server (name: webserver) with an Internet IP Address (ex: 141.146.8.66) and a domain (ex: www.oracle.com). On another server on my LAN (name: dbserver) I have a database server with Oracle 8i installed and a listener on it. I have a database (db01) on dbserver.
    On my machine I have a tnsnames service configured pointing to the listener on dbserver. So I can connect to db01 using:
    conn scott/tiger@db01
    I want to create a listener on my webserver pointing to db01. So I can alter tnsnames pointing to www.oracle.com or 141.146.8.66 an thus connect from any machine with Internet Connection to my oracle database.
    Is it possible ? How can I do this ?
    Thanks.

    You would need to install Oracle Connection Manager on the web server machine and configure that to proxy connections to the database server. The Net Services Administrator's Guide has a diagram of this architecture http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96580/intro.htm#444468
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Error in creating new listener from Enterprise Mgr Console

    When I try to create a new listener from Enterprise Manager Console, it displays an error message: Error in getting data for creating new listener. Check if the listener.ora location "/u01/app/oracle/product/10.2.0/db_1/network/admin" is a valid one. It is absolutely a valid ORACLE_HOME, in fact, I can setup TNS Connect Alias and Profiles from here, but the listener has became a pain in the neck.
    I know I can use the java netmgr or netca or even vi to set it up; however, it is a must that it has to be done through Enterprise Manager Console (show EM manageability issues).
    Thanks for your feedback

    Credentials are valid, so the ORACLE_HOME path, otherwise I would not have been able to modify the other TNSNAMES.ORA and SQLNET.ORA.
    I use the ORACLE_HOME owner credentials (oracle user at the OS level).
    Message was edited by:
    Hector Rivera Madrid
    Message was edited by:
    Madrid

  • How to create a listener for an Object.

    Can someone help me with creating a listener for an Object?
    What is the easiest way?
    For example... if I have the following class.... how could I set up a listener to know if "attribute1" value has changed?
    class MyObject {
    private int attribute1;
    private int attribute2;
    // Set the attribute
    public void setAttribute1(int num) {
    attribute1 = num;

    This can be done but depends on your situation. give me some more details about the program.
    In the worst scenario, u can set up a thread watching this variable to check for its previous value. if the value is different, u can get an alert.

  • Unable to start and create new listener

    hiii everybody,
    I m unable to start listener in win 7 (11g database) using services.msc bcoz it is showing "status as stopped" only and also unable to create a new listener using net configuration assistant which is giving error-"could not create listener".plz, help and ur help apppreciated.thanks.
    os win 7 64 bits
    db 11.2.0.1
    listerner.ora
    # listener.ora Network Configuration File: C:\app\oracle\product\11.2.0\dbhome_2\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    ADR_BASE_orcl = C:\app\oracle
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = C:\app\oracle\product\11.2.0\dbhome_2)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle\product\11.2.0\dbhome_2\bin\oraclr11.dll")
    orcl =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
    ADR_BASE_LISTENER = C:\app\oracle
    Edited by: 938946 on Jan 23, 2013 4:56 AM

    when i run lsnrctl start it is giving tns protocol adapter error and i m unable to start listener from services.msc and unable to create new listener also using net configuration assistant.where m i wrong?
    # listener.ora Network Configuration File: C:\app\oracle\product\11.2.0\dbhome_2\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    ADR_BASE_orcl = C:\app\oracle
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = C:\app\oracle\product\11.2.0\dbhome_2)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle\product\11.2.0\dbhome_2\bin\oraclr11.dll")
    (SID_DESC =
    (SID_NAME = orcl)
    (ORACLE_HOME = C:\app\oracle\product\11.2.0\dbhome_2)
    (SERVICE_NAME = orcl.mbs.ae)
    (SID=orcl)
    orcl =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.86)(PORT = 1521))
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.86)(PORT = 1521))
    ADR_BASE_LISTENER = C:\app\oracle
    SID_LIST_orcl =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = orcl.mbs.ae)
    (SID_NAME = orcl)
    Edited by: 938946 on Jan 23, 2013 5:12 AM

  • Error in Create TCP Listener - Linux

    Hi,
    When using the Create TCP Listener function in Linux Red Hat 9.0, I get an error (ill-formet net address). What is strange is that I get this error only when running the VI (built as an executable) as a regular user. When I run it as root, no problem.
    Any idea?
    Thanks,
    Alex

    Hello Alex,
    We've seen this issue before with Linux users (for example
    http://forums.ni.com/ni/board/message?board.id=170&message.id=63457&requireLogin=False),
    it seems as though you'll have to change some permissions in Linux if
    you want to use TCP when not logged in as root.
    Hope it helps-
    Travis M
    LabVIEW R&D
    National Instruments

  • How to create a listener service at command line?

    Hello,
    I want to create and configure a listener service in an installation script.
    lsnrctl does not support the creation of this service.
    netca or netmgr require user interactions.
    Is there an other tool to create the listener service or is it possible to use netca/netmgr with special options in a command line mode?

    Thank you very much - it works.
    When I execute the command
    "lsnrctl start"
    I get the error message
    "Failed to open service <OracleOraDb10g_home1TNSListener>, error 1060."
    but the service is created and is running.
    So the error message can be ignored.

  • Create db listener usin ssl

    Hello,
    i'm trying to create a listener for a 11GR2 database using ssl, but i'n unable to find a documentation about it. It's necessary to have Oracle Advanced Security installed, but there's a doc on metalink about ir?
    Thanks!

    Pl post details of OS and database versions. MOS Doc 165465.1 (Oracle Advanced Security Frequently Asked Questions) may have some info. Pl also see the OAS Admin Guide at http://download.oracle.com/docs/cd/E11882_01/network.112/e10746/toc.htm
    HTH
    Srini

  • Urgent - How to create new listener in Apache

    Hi,
    I was till now using OAS 4.0.8.2 on NT4 SP5 as our middle tier. We had two sites running on two different listener.
    Recently installed 9iAS 1.0.2.1 in place of OAS 4.0.8.2. My problem is Apache server has one HTTPserver service with default port 80.
    I want to create new listener on different port for our two sites. How can i do with Apche server.
    Would appreciate if someone post an early solution.
    Thanks in advance.
    Vipul

    Your listener.ora may become something like this :
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PLSExtProc)
          (ORACLE_HOME = /S01/app/oracle/product/10.2.0/db_1)
          (PROGRAM = extproc)
        (SID_DESC =
          (SID_NAME = <db name>)
          (ORACLE_HOME = /S01/app/oracle/product/10.2.0/db_1)
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.148)(PORT = 1521))
    SID_LIST_LISTENER1526 =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PLSExtProc1526)
          (ORACLE_HOME = /S01/app/oracle/product/10.2.0/db_1)
          (PROGRAM = extproc)
        (SID_DESC =
          (SID_NAME = <db name>)
          (ORACLE_HOME = /S01/app/oracle/product/10.2.0/db_1)
    LISTENER1526 =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1526))
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.148)(PORT = 1526))
      )You'll have two listeners :
    1. listener => port 1521
    2. listener1526 => port 1526 (listener1526 is a free name, you can name it as you want)
    To start/stop listeners :
    $ lsnrctl start/stop => to start/stop listener on port 1521
    $ lsnrctl start/stop listener1526 => to start stop listener on port 1526

  • Installation didn't create the listener service on Windows

    Dear Gurus,
    I had installed an Oracle 9.2.0.0 in a Windows environment. But when a saw the Windows services in the control panel I saw that the listener service's didn't appear!!!!
    Now I can connect to my Database.
    Can I create the listener by myself or I will have to re-install?
    Regards

    You shouldn't have even needed to "create" the listener. Just going to a command prompt and typing "lsnrctl start" should start the listener, and the service should then be created automatically. This of course assumes that if you have multiple versions of Oracle, the correct one was first in your PATH so that you got the correct version of lsnrctl.

  • How to create a listener using the new MDM API

    Does anyone have an example on how to create a addrecord listener using the new MDM API?

    Refresh!
    Hi all,
    Looking for some sample codes on the same
    Best regards,
    Arun prabhu S

  • How to install certifcate to tmg when create web listener

    how to install certifcate to tmg when create web listener

    Short comment that may help, if you've added the cert while the TMG MMC is open you need to refresh the MMC on the node second to the top (right-click on server/array name and select refresh) or simply restart the MMC.
    Then create the web listener as desired.
    As always you need a cert with the EKU of server authentication (regular web server cert will do) with the corresponding private key and the cert needs to be trusted on the computer where TMG is installed.
    Hth, Anders Janson Enfo Zipper

  • Error while creating the Listener

    HI
    When I try to create the Listner using Net Manager in Oracle10g
    its throwing me the error "A valid Log File is required".
    Could u please tell me how can i create the log file
    Kind Regards
    Ajay

    too from andhra pradesh. now working in sydney on navisionSorry to say that - no personal chats on Oracle Forums!
    You can brief me on [email protected] (or) Yahoo IM: [email protected]
    A valid "Log File" is Required.Let me have look on this and get back to you
    Ravi

  • How to create a Listener to start/pause/stop a  media player

    Hi there,
    I am writing a multimedia Advertisement application. Which will play a list of media clips one by one. HOWEVER, there is NO Button in it. Since this application is for cash register. That means whenever a purchase happens it will stop play the Ads and it will continue play the Ads clips afterwards.
    So, I am thinking to setup some Listener on the player to listen to the control message from the till. As I said there is no GUI button, so I can not define the action listener as before.
    How can I define such a listener ? any thought?
    Thanks a lot.

    Yesss, it is working again, thanks to you.
    A quick recap for those who may need it:
    - 1. delete the keys to Oracle listeners in HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services.
    - 2. follow the instructions detailed in Metalink under "Note:311399.1".
    - 3. Reboot.
    - 4. in the LSNRCTL shell issue the following commands:
    -- a. set current_listener <listener_name>
    If the listener was left without a name, substitute "listener" for "<listener_name>".
    -- b. start
    Thank you again for your help and time.
    adsm

  • How to create a Listener to start/pause/stop a DIY media player

    Hi there,
    I am writing a multimedia Advertisement application. Which will play a list of media clips one by one. HOWEVER, there is NO Button in it. Since this application is for cash register. That means whenever a purchase happens it will stop play the Ads and it will continue play the Ads clips afterwards.
    So, I am thinking to setup some Listener on the player to listen to the control message from the till. As I said there is no GUI button, so I can not define the action listener as before.
    How can I define such a listener ? any thought?
    Thanks a lot.

    Hi Ican, 
    Upon opening your Vi I am getting an error that says, "The file you are attempting to play has an extensions (.) that does not match the file format." What extension are you using? Are you able to play files with extensions that are compatible with Windows Media Playter? If so, then I would suggest converting your playlist filenames an extension that Windows Media Player is able to play.
    Regards,
    Jackie
    DAQ Product Marketing Engineer
    National Instruments

Maybe you are looking for

  • No sound on audiotrack, please help!

    Can record a guitar track, then create a new track with record enabled, and play while the first track is playing... no sound. meters are picking it up but can not monitor. I must have hit something.. I have been using the program for a 2 years - nev

  • AirDrop is not working properly on my Ipad mini, it doesn't have the accept button. What can I do?

    AirDrop is not working properly on my Ipad mini, it doesn't have the accept button. What can I do?

  • SAP FI Blueprint and doc - Very Very Urgent

    Hi SAP Gurus, My Company is implementing SAP ECC 6.0 and I have been assigned for the documentation for the project . Right from Blueprinting , realization till production support. I m not clear as what information do i need to gather gather from the

  • ESS/MSS - Floor Plan Manager - DC Model Modification

    Hi, We are working on ESS/MSS business package based on FPM framework (WebDynpro). We have a small requirement but implementation of this is causing hell lot of problem. So I am looking for expert opinion on this. We are modifying Address Data DC for

  • Error en Forms server 6i in Linux

    Hello!, I am trying to execute forms in Linux, which were created in Windows, have created myself a file for this (I put but below), but when I execute it he/she always gives me the same error,FRM-91500: Unable to start/complete the build. Somewhere