Solved

Listening on TCP/IP port

Posted on 2004-03-31
12
1,654 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
  • 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
 

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now