A question about a piece of scan port program

The program as the following:
import java.net.*;
import java.io.*;
public class Scan
  public static void main(String[] args)
    String host;
    Socket theTCPsocket;
    InetAddress hostAddress;
    if (args.length < 1)
      host = "localhost";
    else
      host = args[0];
    try
      hostAddress=InetAddress.getByName(host);
   for (int i = 0; i < 65535; i++)
        try
          theTCPsocket = new Socket(hostAddress, i);
          System.out.print("TCP port " + i + " of " + host + " is open");
          switch(i)
            case 21:
            System.out.println("(maybe there is a FTP server is running)");
            break;
            case 23:
            System.out.println("(maybe there is a TELNET server is running)");
            break;
            case 25:
            System.out.println("(maybe there is a SMTP server is running)");
            break;
            case 80:
            System.out.println("(maybe there is a HTTP server is running)");
            break;
            case 110:
            System.out.println("(maybe there is a POP server is running)");
            break;
            case 139:
            System.out.println("(This server's netBIOS is reachable)");
            break;
          theTCPsocket.close();
        catch (IOException e)
     catch (UnknownHostException e)
      System.err.println("the hostname:"+host+"is unknown or can not be analysed!");
}  The question is: I don't know why the System.out.print("TCP port " + i + " of " + host + " is open"); in for (int i = 0; i < 65535; i++)
try
theTCPsocket = new Socket(hostAddress, i);
System.out.print("TCP port " + i + " of " + host + " is open"); is not run everytime when i equal from 0 to65535,but it just run when i=21 and etc?
Please help me!
Thanks!
yours
spark
Message was edited by:
spark077

Don't run this program except on your own computer(s), but the answer is that if the port isn't being listened to, the Socket constructor throws an IOException which you are handling with the following code:
    {}and then continuing with the loop. So if the port isn't being listened to, nothing will be printed.

Similar Messages

  • Question about using TVARV in an ABAP program

    Hello gurus, Im sorry about the silly question.
    I have a question about using TVARV in an ABAP program.
    A program is presenting a problem and I think that in this code:
    SELECT SIGN OPTI LOW HIGH
      FROM TVARV
      INTO TABLE R_1_163431035_VELOCIDADE
      WHERE  NAME = '1_163431035_VELOCIDADE'
      AND    TYPE = 'S'.
      IF ZMM001-VELOCIDADE_B   IN R_1_163431035_VELOCIDADE AND
          ZOPERADORAS-OPERADORA = 'ABCD' AND
          ZMM001-MATERIAL       IN R_1_163431035_PRODUTO.
      ELSE.
      ENDIF.
    What happens is that the value "ZMM001-SPEED" B not exist in "R1_163431035_VELOCIDADE" but the program executes commands under the IF and not under the ELSE, as I imagine it would work. Is this correct ?
    I am new to ABAP programming, but I have a lot of XP in other programming languages ​​and this makes no sense to me.
    Anyone know where I can find some documentation of the use of "TVARV" in ABAP programs?
    I search the Internet if other programmers use TVARV this way, but found nothing, which leads me to think that was a quick and dirty solution that used here.
    If this is a bad way to program, what would be the best way?
    Regards
    Ronaldo.

    Hi Ronaldo,
    But in this case, the range is not empty, there are 17 records, in this way.:
    For the column "SING" all values ​​are "E"
    It means that the result is false if ZMM001-VELOCIDADE_B has the same value as one of the 17 records (E = exclude).
    For instance, if it has value 'C' and one of 17 records matches C, then the result is false.
    The "IF" with "IN" using "TVARV" as used in the program of the post above has the same behavior of a selection screen?
    Yes, the same behavior as the selection criterion to be exact. You can press the help key in the complex selection dialog for more info.
    I know it's a silly and very basic question, but other language that I used, only the SQL has the "IN" operator, but I think they work in different ways, so I would like to understand how it works in ABAP.
    Not silly ;-). Yes they work differently.
    More info here:
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba74635c111d1829f0000e829fbfe/frameset.htm
    - http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm
    BR
    Sandra

  • Question about Workstation Performance during Scanning

    I am looking for information about workstation performace during
    scanning
    for inventory. My management wants information on impact before I can
    implement the service in our environment. We do have a very wide
    array of
    computers. Anything from Win95 P200 to Win2k/XP P4 3Ghz. Can anyone
    point me
    in the right direction?

    Inventory is minimal.
    The first scan takes the most performance. On a p200 we are talking
    about 5 minutes with little or no performance hit.
    After that, only changes are sent to the server.
    I wasn't able to find any doc that talked about performance, but you
    can read about inventory in the ZFD documentation.
    Hope that helps.
    Jared L Jennings, CNE
    Novell Support Forums SysOp

  • A question about the multiple RS-232 ports with Labview program?

    Hi Sir/Madam,
    I am using ME9100/82 card from ICS electronics company to connect the computer with multiple
    instruments. I first connect card with ME-D9/8 on which there are 8 RS-232
    ports, and then use every port to connect one instrument. My question
    are :
    1. How can my program identify which port, i.e. what can I do in my
    program to send a command to port 1 not port 2, for instance?
    2. Can I send one command to the 1st instrument and the other command to 2nd
    instrument at the same time?
    3. I am using Labview to compile a program, and the version of Labview
    that I am using is 6.0. How can I implement send several commands to
    different instruments at the same time? Could you please provid
    e a simple example in Labview 6.0 for the multiple ports communication?
    4. Has any one used MKS 937A, MKS 600 Series and MKS 247 instruments? Could you please provide an example for displaying parameters in Labview 6.0?
    Thanks a lot.

    Under the Instrument I/O section of the Function Palette there is a indicator called VISA Resource Name Constant click on that and drag it to your diagram, right click and change it to a control. On the Panel this will automatically allow you to choose any ports available ( add in one for each port you want to use). Add in a VISA Configure Serial Port for each port and plug the terminal to the resource name into it then just add in the functions you what it to do (read, write, etc.) just as if it were the only port.
    Also on the panel side go under file on the toolbar and select vi properties, select execution, and where it says preferred execution system select other1 to allow each port function to run parallel.
    Attachments:
    example.vi ‏47 KB

  • Question about trying to install an old program

    I am trying to install music writing software from a CD. This software has worked well for me on XP and Windows 7. When I tried to run it from the disk, I got an error message. So, I went through the whole "compatibility mode" process, trying it
    in both XP and Windows 7 modes, without success. The installation process would begin, but then it would hang up. The software in question is called "Mozart," and I am attempting to run an early version, Mozart 6. The website for the software is
    mozart dot co dot uk.
    Now, here's the rub: I posted a question about this at the Mozart Software Yahoo Group, and one participant there said that he had installed Mozart 6 on a Windows 8 computer without difficulty. So, the question becomes, what am I doing wrong? Or do I have
    a hardware problem? I have a new Toshiba laptop with 6 gigs of ram. I have Avast anti-virus software as well as Spybot anti-spyware software - could one of those be blocking a program installation from the disk drive?

    Did you try download the latest version or applied the latest service pack?
    This software is not free, you can also contact them for better support
    Also using 2 antivirus is not recommended. You also can try to disable them, disable UAC and disable firewall to check

  • Question about output through the DVI port

    The problem: I am using a DVI to HDMI cable to send video to an AV receiver. The AV receiver strictly only accepts a DVI-D (Digital) signal. Upon turning it all on, the MacBook Pro screen reloads and appears to be sending video out, based on the AV receiver's model name appearing in the Display's menu bar. The receiver however reads "No Signal". Most likely this is because the MBP's dual-signal port is giving it problems (it can send both analog and digital).
    Is it possible to elect to send a digital-only signal? The cable itself does not include the extra pins for analog, so I'm not sure why it would think it is.
    Keep in mind I'm not entirely sure this is the problem, I just have confidence in this theory.
    Regards,
    Edward

    HDCP: The cause of, and solution to, all of life's problems.

  • Questions about remote control and infrared port Qosmio F20

    Hi again,
    My Toshiba Qosmio F20 comes with a remote control funcioning through a infrared device on the front of the computer.
    Regarding this I have 2 questions:
    1. How do I configure additonal functionality through the remote control? (Like launching and controlling Winamp?)
    2. How do I connect other devices, like my cellular phone, pdas etc., to the infrared device on my computer?
    Kind regards,
    Vegard

    Hi,
    the Remote Control delivered with the Qosmio F20 is designed only for Windows XP Media Center Edition (all Remote Control's which are designed for Windows XP Media Center Edition work only with Media Center or Windows Media Player). Other program's like Winamp were not supported by these Remote Control's.
    I believe, the Remote Control's are made by Microsoft and for a wide palette of product's (the Infrared Transceiver is on nearly all Media Center PC's e.g. Siemens-Fujitsu, the same). So it's a little bit tricky to support more program's then Media Center or Windows Media Player.
    For other program's you need a second Remote Control like this one:
    http://www.logitech.com/index.cfm/products/detailsharmony/GB/EN,CRID=2084,CONTENTID=9193
    br, Ben

  • Questions about System Requirements for Adobe Air programs

         Earlier today I asked someone who runs Tweetdeck if they knew what the system requirements were for running Tweetdeck on my desktop (Windows)
    they gave me a link here: http://www.adobe.com/products/air/systemreqs/
    and I found this:
    Windows
    2.33GHz Intel® Pentium® 4, AMD Athlon® 64 2800+, or faster processor
    Microsoft® Windows® XP Home, Professional, or Tablet PC Edition with  Service Pack 3; Windows Server® 2003 or 2008; Windows Vista® Home  Premium, Business, Ultimate, or Enterprise (including 64-bit editions)  with Service Pack 2; or Windows 7
    512MB of RAM (1GB recommended)
    Here are my computer statistics:
    Operating System: Windows Vista™ Home Basic (6.0, Build 6001) Service Pack 1 (6001.vistasp1_ldr.101014-0432)
               Language: English (Regional Setting: English)
    System Manufacturer: Hewlett-Packard
           System Model: Compaq Presario CQ60 Notebook PC
                   BIOS: PhoenixBIOS 4.0 Release 6.1    
              Processor: AMD Athlon Dual-Core QL-65 (2 CPUs), ~2.1GHz
                 Memory: 2814MB RAM
              Page File: 1858MB used, 3993MB available
            Windows Dir: C:\Windows
        DirectX Version: DirectX 10
    DX Setup Parameters: Not found
         DxDiag Version: 6.00.6001.18000 32bit Unicode
    Will me only having a 2.1GHz processor really affect how my performance is with Adobe Air products/apps in general?

    Yes- I've had some lower price pc's using an Adobe AIR app and can tell the difference.
    Computers where performance was a huge issue was Compaq CQ56 & Toshiba Satellite C655D
    These computers are under 2.0 GHz and the app seems to freeze up on occassion or run slower.

  • I have a question, about SSF !(u5173u4E8ESSFu7684u95EEu9898)

    Hi,guys!
        I have a question, about SSF.I want my webdynpro program can get employee photo in ECC6.0.So i find a BAPI,it name is:HRMSS_RFC_EP_READ_PHOTO_URI.I import parameter PENER with employeeID,other parameter is default.It returns a URI,but this URI was been encrypt.I copy the URI into IE,the IE told me:SSF error,can not decode.So my question is:in this instance,what should I do?
        Thanks! I am very vexation,online waiting!

    Dear Mr. XU,
    this is a community driven forum, meaning most answers are given by community members volunteering and contributing free time. If you'd like to express your vexation, you might better use the SAP based support channels such as OSS.
    Community members are in general not motivated to answer questions that are posted in such a mood.
    As I'm an SAP employee myself, I have to apologize that I cannot answer this question due to a lack of understanding it and again have to ask you to check with OSS.
    With kind regards,
    Benny Schaich

  • I hava a question about RMI,please help me!

    Ladys and Gentleman,I hava a question about RMI.I wirte four little programs in java that is about RMI on my PC.
    import java.rmi.*;
    public interface AddServerIntf extends Remote{
    double add(double d1,double d2) throws RemoteException;
    import java.rmi.*;
    import java.rmi.server.*;
    public class AddServerImpl extends UnicastRemoteObject implements AddServerIntf{
    public AddServerImpl() throws RemoteException{
    public double add(double d1,double d2)throws RemoteException{
    return d1+d2;
    import java.net.*;
    import java.rmi.*;
    public class AddServer{
    public static void main(String args[]){
    try{
    AddServerImpl addServerImpl=new AddServerImpl();
    Naming.rebind("AddServer",addServerImpl);
    }catch(Exception e){
    e.printStackTrace();
    import java.rmi.*;
    public class AddClient
         public static void main(String args[]){
         try{
         String addServerURL="rmi://"+args[0]+"/AddServer";
         AddServerIntf addServerIntf=(AddServerIntf) Naming.lookup(addServerURL);
         System.out.println("The first number is: "+args[1]);
         double d1=Double.valueOf(args[1]).doubleValue();
         System.out.println("The second number is: "+args[2]);
         double d2=Double.valueOf(args[2]).doubleValue();
         System.out.print("The sum is: "+addServerIntf.add(d1,d2));
         }catch(Exception e){
         System.out.println("Exception: "+e);
    And I compiled these files,so I got 4 class files(AddServer.class,AddServerIntf.class,AddServerImpl.class,AddServerClient.class).Then I use "rmic AddServerImpl" got another two files(AddServerImpl_Skel.class and AddServerImpl_Stub.class).Then I input command:rmiregistry,in another window,I input command:java AddServer,I got some exceptions,I was confused by these exceptions.The exception is:
    D:\MyJava\rmi_3>java AddServer
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: AddServerImpl_Stub
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: AddServerImpl_Stub
    java.lang.ClassNotFoundException: AddServerImpl_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Unknown Source)
    at AddServer.main(AddServer.java:8)
    But some times this exception will not appeared.Who can give me answer or suggestion,thanks a lot.
    By the way,when I run shutdown.bat in tomcat_root\bin,I can get some exceptions:
    C:\Tomcat\bin>shutdown
    Using CATALINA_BASE: ..
    Using CATALINA_HOME: ..
    Using CATALINA_TMPDIR: ..\temp
    Using JAVA_HOME: C:\JDK
    Catalina.stop: java.net.ConnectException: Connection refused: connect
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:137)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:124)
    at java.net.Socket.<init>(Socket.java:268)
    at java.net.Socket.<init>(Socket.java:95)
    at org.apache.catalina.startup.Catalina.stop(Catalina.java:579)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
    I use Windows server 2000+JDK 1.3.1_04+tomcat 4.1.7

    Maybe I am off base here but it seems to me the problem is the way in which you bind your server. The server must be bound to the same address and you are looking up from, i.e. "rmi://" host "/AddServer"
    so
    Naming.rebind("AddServer",addServerImpl);should be
    Naming.rebind("rmi://127.0.0.1/AddServer", addServerImpl);to match
    String addServerURL="rmi://"+args[0]+"/AddServer";
    AddServerIntf addServerIntf=(AddServerIntf)
    Naming.lookup(addServerURL);Hopefully this will solve your problem, if not it is a problem with your classpath. An easy way to make sure it can see your files is to set the java.rmi.server.codebase to point to where your classes are, e.g.
    java -Djava.rmi.server.codebase=file:"c:\\cygwin\\home\\tweak\\keck_folder\\cmsi401\\RMIGalaxySleuth\\classes\\" AddServer
    I had to set the codebas for my rmi stuff to work no matter how much I messed with the classpath.
    Hope this helps,
    Will

  • QUICK QUESTION ABOUT PORTS

    Hi, I have a quick question about port forwarding/mapping. My question, lets say I am running MSN messenger, who's ports are 6880-6900. But lets say I am running a torrent application or something else that requires those ports. If both applications were running at the same time, would this cause interference with them on the same ports or now. Thanks
    Nathan

    Normally, only one application can listen to a specific port number at a time. If MSN is grabbing those 21 ports then your torrent app won't be able to run.
    However, most apps don't work that way - even if they use multiple ports, they don't use them all at the same time, so MSN might use 6880 when it starts up, leaving the others open for other applications to use if needed.
    Only experimentation will answer that one.

  • Question About FireWire 800 port

    With the coming of these new Firewire ports I have a question about using my FireStudio Project, It uses normal Firewire, now will I need to buy a Adaptor, or does apple even make one?? Will this still work, I don't get why they had to change it anyway, I mean I know it's faster, but now it's just more adaptors I have to buy, that is if they even make one.
    Message was edited by: Anthony82
    null

    There are plenty of adapters and cables out there. They're not that expensive ($5-$30). You can get a 9 pin to 6 pin firewire adapter and use whatever cable you used before. You could also get a 6 pin to 9 pin adapter. Do a search on amazon or your favorite electronics store, and you'll find plenty. Here's what Apple sells:
    http://store.apple.com/us/product/TP320LL/A?mco=NDc4NjQ5OA

  • Question about ports

    Hi,
    I have a clarification question about ports and Java. Assuming all firewalls are disabled on a PC, a Java application can connect to any port via a socket to communicate with other PCs, as long as this port is not used by another application.
    Is the following correct:
    a) Two applications (Java or no) cannot connect to the same port together, ever.
    b) Two Java applications sending and receiving datagram over a given multicast address using the same port can never communicate with each other when ran on the same PC because of a).
    Thanks,
    J.

    Jrm wrote:
    Hi,
    I have a clarification question about ports and Java. Assuming all firewalls are disabled on a PC, a Java application can connect to any port via a socket to communicate with other PCs, as long as this port is not used by another application.You mean bind to a port to act as a server? Yes. As long as that port is not already bound for listening.
    If you mean a client application can connect to any port where a server is listening, then it doesn't matter if another client is talking to the server on that port, as long as the server is written to handle concurrent connections.
    >
    Is the following correct:
    a) Two applications (Java or no) cannot connect to the same port together, ever. No, see above. Unless by "connect" you mean "bind". (Even that may be incorrect terminology.)
    b) Two Java applications sending and receiving datagram over a given multicast address using the same port can never communicate with each other when ran on the same PC because of a).Not sure exactly what you're saying here.
    Really, though, why not just write some code and try it?

  • A question about opening ports

    I have a question about opening ports with the airport. I need to open up ports UDP 88 & 3074 and port TCP 3074. I am wondering if I should open these ports for the specific IP address on my network that will be using them or if I should open the ports on the gateway IP (10.0.1.1) not sure which is the right route to take. Any help would be appreciated.
    These are for running an xbox over xbox live.

    Typically, you will want to open these ports for the device on your local network that needs to be accessed from the Internet. In this case, it would be your Xbox 360.
    Unfortunately, the AirPorts are not listed as Xbox Live-compatible routers ... so there is no guarantee doing this will get Open NAT status for Xbox Live.
    The following web blog does a great job explaining the NAT issues with Xbox Live. Basically what it comes down to is that although you can get an Internet connection for the Xbox 360 with the AirPorts, you may not get the necessary NAT setting (Moderate or Open) for the Xbox Live game that you want to play. As such, Port mapping may be required to allow Xbox Live access.
    The following ports must be available for Xbox Live to operate correctly:
    • UDP 88
    • UDP 3074
    • TCP 3074
    To setup port mapping on an 802.11n AirPort Extreme Base Station (AEBSn), either connect to the AEBSn's wireless network or temporarily connect directly, using an Ethernet cable, to one of the LAN port of the AEBSn, and then use the AirPort Utility, in Manual Setup, to make these settings:
    1. Reserve a DHCP-provided IP address for the Xbox 360.
    Internet > DHCP tab
    o On the DHCP tab, click the "+" (Add) button to enter DHCP Reservations.
    o Description: <enter the desired description of the host device>
    o Reserve address by: MAC Address
    o Click Continue.
    o MAC Address: <enter the MAC hardware address of the Xbox>
    o IPv4 Address: <enter the desired IP address>
    o Click Done.
    2. Setup Port Mapping on the AEBSn.
    Advanced > Port Mapping tab
    o Click the "+" (Add) button
    o Service: <choose the appropriate service from the Service pop-up menu>
    o Public UDP Port(s): 88, 3074
    o Public TCP Port(s): 3074
    o Private IP Address: <enter the DHCP Reserved IP address for the Xbox you created earlier>
    o Private UDP Port(s): 88, 3074
    o Private TCP Port(s): 3074
    o Click "Continue"

  • Question about port C++ code to C

    I have a newbie question about C++
    I'm being ask to port a C++ sharelib into a kernel driver for work so from C++ => C.  I'm not at all familiar with C++ but i'm making some leeway.  However i'm a little stuck, what does the following line of code in bold mean in C++ and how would I translate it into C code? 
    #include <deque>
    struct _buffer
        UINT8* buffer;
        UINT8 length;
    typedef deque< struct _buffer* > MSGQUEUE;
    I'm assuming it's type defining a deque of the struct _buffer???  but I'm confused by the <...>, what does that operator do in C++.  Is it defining a struct _buffer pointer within the deque??? 
    This might like a "DUH it means...." question to some people so sorry about the stupid question.
    --Vincent

    <> is template syntax and is generally the type of object a container holds..   So it is defining that the MSGQUEUE type is a deque holding struct_buffer*'s.

Maybe you are looking for

  • How do I create a shared photo stream?

    I see discussions regarding shared photo streams - all pertaining to issues with existing shared photo streams.  I don't see anything that provides instructions on how to create a shared photo stream.  How is this accomplished?  And how do I allow so

  • I had a problem with sing in in my other computer

    i cannot sing in from my new computer from laptop i can do everything but from computer no pls help me 

  • Keywords and subordinates Aperture 3.4

    I have Aperture 3.4.3. When I try to create a Keyword and a subordinate and tag the photo with the subordinate, only the subordinate tag appears on the photo and not the Parent Key Word.  For instance, I type Bird as a Keyword, add Cardinal as a subo

  • Admin and Guest account internet

    Hello, I have a little bit of a problem. I have two accounts; one is an Admin account and the other one is a Guest account. When I use the Admin account, I can connect to the internet with no problems. But when I use the Guest account, I can't connec

  • FMM & Guest Account

    Hi All, Albeit loads of people have complained about the appearance of the Guest Account on log in with the FMM app running, I have the opposite. Even with FMM running there is no Guest Account availble on login. And, when checking Users to enable "r