Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Listening on TCP/IP port

Posted on 2004-03-31
12
Medium Priority
?
1,894 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
Technology Partners: 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

688 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