Solved

Listening on TCP/IP port

Posted on 2004-03-31
12
1,685 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 79
delphi parse string to params 3 100
How to build JSON File in Delphi 6 3 14
update joined tables 2 31
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

16 Experts available now in Live!

Get 1:1 Help Now