Solved

Listening on TCP/IP port

Posted on 2004-03-31
12
1,801 Views
Last Modified: 2010-04-05
I'm try to write an application to monitor the data sent out via UDP on the local machine's port. The port number is known. Can anyone tell me how to program in Delphi. I'd like to use Indy components. Any suggestions?

ysimon
0
Comment
Question by:ysimon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
12 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10727425
Do you have Indy Components? If not - www.nevrona.com/indy

 drop the corresponding Indy component on your form, (IdUDPClient for UDP), set the port to 5500 and address to localhost or IP address of current computer, then finally call the Listen method.


Shane
0
 

Author Comment

by:ysimon
ID: 10736628
I have Indy components.
Why should I use IdUDPClient instead of IdUDPServer?
Why do I set the port number to 5500?
I checked the IdUDPClient/IdUDPServer, there is no the Listen method for both of them.

ysimon
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10736682

Sorry, those were examples of the top of my head (kinda pseudo code)

Example:

TidUDPServer, I believe has a defaultPort property, and a OnRead event versus OnListen


Shane

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ysimon
ID: 10737152
The IdUDPServer can get the data when OnRead event happens and when the data was sent to the local PC on the default port.

I can not make the IdUDPServer listen to all ports. I try to set port number 0, 5500, they didn't work. I do need to listen to all ports. Any suggestions?

ysimon
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10737181
Hmmmm,



 How about a TServerSocket, I know you can explicity tell it a port and it has a OnListen event.

uses Sockets;

Shane
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10739058
When u set the active property of the Server ,
  It starts listening ...

check it with
Netstat -n -a command u ll see that ur port status ll be listening ..



0
 

Author Comment

by:ysimon
ID: 10742073
My problem is how to monitor an UDP packet coming to the local PC on the known port from a remote PC. The loca listen port cannot be set to the same number because a the local server application is running(using that port). I know some spy applications can monitor the packets on the network, I'd like to know how to implement it in Delphi.

ysimon
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 50 total points
ID: 10744112
What u want is an IP Sniffer ..

here is an source Code ....

http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=971&lngWId=7
0
 
LVL 3

Expert Comment

by:Aliev
ID: 10776086
Use TClienSocket and TServerSocket on Internet tab on components toolbar.
It is easy to use and very simply. I am working and works without any problems. Bur on Indy components you will many problems.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question