aspose file tools*
The moose likes Java in General and the fly likes Listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Listener" Watch "Listener" New topic
Author

Listener

Alan So
Greenhorn

Joined: Sep 07, 2011
Posts: 10
Hi all,

I need some help. I am writing a program to listen an alert from a server after that the alert will be do something.

May I know how can I start to do it or is there an example on alert listener for server?

Because I google and all I find is regards to event listener.

So any kind soul can help me out. Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

Welcome to the Ranch.

You first have to find out how exactly the server sends the alert.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Alan So
Greenhorn

Joined: Sep 07, 2011
Posts: 10
Jesper de Jong wrote:Welcome to the Ranch.

You first have to find out how exactly the server sends the alert.


Thanks.

The alerts are send by the APIs according to what I have been told. And listen to a TCP/IP port example 0080. the server will send a XML data which is the alert.

So I not sure how can I start or integrate it.

I understand that the ClientListener should be a jar file which is a class file i suppose, so that I can create a new instance. And this clientlistener file it should be provided, am I right?

And this is what I have from them..



Please advice and help again. Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

So, you have a special API to receive those alerts? It's not part of standard Java, so I don't know that API. Ask the people who gave you the API for documentation.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40029
    
  28
Question too difficult for "beginning". Moving discussion.
Alan So
Greenhorn

Joined: Sep 07, 2011
Posts: 10
Ok I have requested for the API.

But in the mean time, should I do the codes for listening to the port and event/alert listener too not wasting time on waiting.

So is there any direction that I can look into it because I have google quite a lot but I cant find an alert listener example to listen to a tcp/ip port.

Please advice thanks.
Alan So
Greenhorn

Joined: Sep 07, 2011
Posts: 10
The coding is done in java just that I need some help on how can I add an alert listener to a tcp/ip port.

I have try finding but all exampls mention only on listening to tcp/ip port.

Or am I in the wrong direction?? or the alert listener should done on the server side instead?

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

If you need to use the API that you get from someone, then you'll need the documentation etc. and do it as is described there. It doesn't help much to try to build something that listens to a TCP/IP port, not really knowing what you are doing or if this is going to work with the specific server that you're using.

It's like you're going to build a house, but you don't have a plan yet and you want to start building immediately while not knowing at all what the house should look like.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listener