Solved

Listening on TCP/IP port

Posted on 2004-03-31
12
1,705 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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