Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

UDP Port Scanner

Posted on 2003-11-14
8
Medium Priority
?
1,810 Views
Last Modified: 2012-05-04
Could someone show me how to make a UDP port scanner in delphi.

I've aready made a TCP port scanner, but how would I make a UDP port scanner.

Could someone show me how this is done?
0
Comment
Question by:Shinez
  • 4
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 400 total points
ID: 9750481
Just open UDP socket instead TCP socket ;-)
0
 

Author Comment

by:Shinez
ID: 9751204
How Would I do this?
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9753785
Ok, I'll try to explain.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9753825
It's impossible to scan UDP port if it just was opened.
You can determine that UDP port is opened by sending some datagram to the port only.
And if you'll be lucky you'll got an answer from the server.
But server is not obliged to answer to you if you don't know its protocol ;-)

So, if you know what server you are looking for and you know its protocol then try to send some command (according to the protocol) and wait for an answer from the server. ip-by-ip, port-by-port ;-)

Good luck.
0
 

Author Comment

by:Shinez
ID: 9758218
could you show me how this is done, have edit1 for ip and edit2 for port and for label1 to display if port is open/close.

if I wanted to check if the port is open for ut2003.

default game port is 7777, the query port is 7778.

how would I get a responce that the server is up?

please could you give some code with your answer, I don't know that much about UDP.

thxs
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9762835
There is no "open" and "close" terms applying to the UDP protocol.

...
Var buff: array[0..256] of byte;
...
   UDPClient := TNMUDP.Create(self);
   UDPClient.RemoteHost := 'ut2003'; // or something like '192.168.1.15'
   UDPClient.RemotePort := 7778;
   UDPClient.LocalPort := 7777;
   UDPClient.OnDataReceived := UDPClientDataReceived;
   UDPClient.OnStatus := UDPClientStatus;
   UDPClient.OnInvalidHost := UDPClientInvalidHost;
   UDPClient.OnStreamInvalid := UDPClientStreamInvalid;
   UDPClient.OnBufferInvalid := UDPClientBufferInvalid;
...

   StrPCopy(buff, "Hello!");
   try UDPClient.SendBuffer(buff, 7);
   except;
     // Error
   end;

...
procedure TMainForm.UDPClientDataReceived(Sender: TComponent;
  NumberBytes: Integer; FromIP: String);
Var buff: array[0..256] of byte;
begin
  UDPClient.ReadBuffer(buff, NumberBytes);
end;

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline

772 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