How to read contents of TCP packets in Internet

i want to get the IP address of a packet from the remote host in Internet and read what each fields mean for designing a firewall
with address and service filters and acting as a applicaiton gateway?
so i want to read headers and other fields of the incoming packets
and authenicate it
which package and class can we be used for this in Java?

You can't - java doesn't do raw sockets.
You can use JNI for this.
There are OS dependencies as well. Some versions of windows will require additional drivers to do this.
You can roll your own or start here... http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html

Similar Messages

  • How to read contents of more than 2 files.

    hi all
    help me.
    How to read contents of more than 2 files.
    For reading a file contents we uses normally FileInputStream
    For reading two file contents we uses normally SequenceInputStream
    But which class we have to use for reading contents of more than 2 files at a time
    thanks in advance.

    SequenceInputStream can be used for reading any number of input streams (not at once, but one after the other).
    This involves making an Enumeration that returns the input streams you want to read. Depending on what you want to do, it might be just as easy to read them one after another.
    Or consider making a Vector of your input streams and using its elements() method. Like this:(untested)Vector<InputStream> inVec = new Vector<InputStream>();
    inVec.add(new FileInputStream("foo.dat"));
    inVec.add(new FileInputStream("bar.dat"));
    inVec.add(new FileInputStream("baz.dat"));
    // later...
    SequenceInputStream in = new SequenceInputStream(inVec.elements());

  • How to read contents of a property file sequentially

    hello all,
    please can any one tell me how to read contents of a property file sequentially.
    i saw most of the classes provided by JAVA API, which get All keys and there return type is enumeration which dosent preserve , or may the getKeys() method of those classes do not preserve the sequential order.
    Kindly do let me know if anyone has done this before.
    Thanks.

    The best solution is that you redesign your program so that it does not depend on the order of the entries in the properties file.
    If you really want to stay with your design, you will have to read the properties file yourself, line by line, just like you would read any other text file, and parse the content of each line yourself.
    BufferedReader in = new BufferedReader(new FileReader("stuff.properties"));
    String line;
    while ((line = in.readLine()) != null) {
        // Parse the line, use e.g. String.split() to split it around the '='
    in.close();

  • How to read contents of files that do not fall under public security group?

    Hi,
    I need to read the contents of a WCM based xml file that does not fall under public security.
    The process is like this:
    First the user makes chnages to the content.
    The workflow will be triggred based on the security group metadata that is associated with the content.
    Once the content is finally approved our workflow calls a custom idoc script.
    First we tried directly reading the xml contents from the idoc script which was still in the context of workflow. But since content item is still in workflow I was not able to read the changes. So I created a separate content publisher thread and read the DOC_INFO and checked for the dStatus value. If the value is RELEASED then I reading contents by calling ssIncludeXml idoc script.
    This was working fine for public content. But now the requirement is that all content cannot be public. Content authors should not be able to edit the content that does not belong to their group, So we created security groups (and roles) and are associating that groups to the relavent content.
    Beacuse of this change I am not not able to read the non public content. The call to DOC_INFO_BY_NAME service, which gives all the content files' metadata, is expecting the user to be logged in to give the details.
    I tried calling the CHECKIN service with sysadmin and captured the cookies returned by that service and use cookies for the DOC_INFO_BY_NAME service call. But the service call was faling. It is throing the 401 forbidden error with the message that user needs to be logged in to get the details.
    How to address this problem. Someone please help.
    Note: I also tried using ridc for this. I was able to get it working but since it is executing in the context of server ridc api is changing server's environment properties like HTTP_HOST, HTTP_CGIPATHROOT etc. It also seemed like system was becoming non functional after using ridc. When I called check-in the system metadata values like security group are no more loading. Not sure if ridc is the culprit here but worried that it might be causing this issue.
    Regards,
    Pratap

    Sorry, I posted too much details while posting this question. I was saying "not able to read *non* public content".
    Anyway, I was able to resolve the issue. I was able to authenticate with sysadmin credentials in the request to service using basic authentication and was able to read doc info with that credential.
    But I realized there is more than option for reading secure content.
    - I could set user name as sysadmin in the m_environment (if I am in the context of a service) and the call the DOC_INFO_BY_NAME service.
    - I can post an HTTP request to DOC_INFO_BY_NAME service with sysadmin credentials and do basic authorization via the connection. (This is what i have done successfully as of now )
    - I could add guest role to all security groups with R (read) privileges.
    I will look into all options and implement the one which is more apt.
    Regards,
    Pratap

  • How to read contents of an array into a variable?

    Gurus,
    I'm trying to read contents of a table or array into a varray variable. I want to know the syntax of how to accomplish the same. Please help
    Here is what i have,
    v_sub_query varray(10) of varchar2;
    v_sub_query should read contents of an array and hold values. I'm trying to do this and then use each values of v_sub_query(index) into a dynamic sql statement.
    thanks
    SS

    Sign is definately not king when it comes to PL/SQL as his advice is flawed. Row-by-row processing simply causes a lot of context switches from the PL/SQL engine to the SQL engine and back. And this results in a significant performance impact. Never mind that this style of 80's COBOL processing it sadly outdated in the 21st century when dealing with a modern RDBMS likle Oracle.
    The correct way to populate an array in PL/SQL with SQL data, is to bulk collect it. However, a varray data type is not the best suited data type for this - as they are fixed sized. Dynamic arrays are more flexible.
    Simple example:SQL> declare
      2    type TStrings is table of varchar2(30);
      3    cursor c is select object_name from all_objects order by 1;
      4    v_NameTable      TStrings;
      5  begin
      6    open c;
      7    loop
      8      fetch c bulk collect into v_NameTable limit 100;  -- fetch 100 rows at a time
      9      -- process the array
    10      for i in 1..v_NameTable.Count
    11      loop
    12          -- process element v_NameTable(i)
    13          null;
    14      end loop;
    15      exit when c%NOTFOUND;
    16    end loop;
    17    close c;
    18* end;
    SQL> /Refer to the Chapter 5. Using PL/SQL Collections and Records of the Oracle® Database PL/SQL User's Guide and Reference guide.
    As for dynamic SQL - remember to use bind variables. Do not hardcode the array values into the SQL statement as the resulting SQL will not be sharable and will cause performance problems with SQL parsing and shared pool memory fragmentation and malloc errors.

  • How to read content between xml tags?

    is there any way to read the content between xml tag

    > is there any way to read the content between xml tag
    Yes. Are you having some sort of problem? If so, please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.
    Please post a short, concise, executable example of what you're trying to do. Don't post the actual code you are using (I can't emphasize this strongly enough). Just write a small example that demonstrates the problem, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
    Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
    Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.
    If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.
    Help us help you solve your problem.
    ~

  • How to read content on receive mail atom

    Hi Expert,
    I used the received mail atom but in the mail entry not able to find content.
    So please let me know how can I read the content from Receive email atom in B1if.
    Thanks,
    Tushar

    Hello Tomas,
    Please find the screen shot and plz suggest if i m wrong.
    Thanks
    Sam

  • How to read contents of the Super Block ext2

    there I'm working on traversing an ext2 filesystem to read from it and I'm stumped at the first hurdle. The filesystem has a block size of 1024 bytes, so I need to read from the first 1024 bytes into an array to get Block Group 0. From there I need to go to the position of the super block, but I don't know how to go through the following first steps:
    1 Find the Group Descriptor 2 Read the Inode Table Pointer value to find the block containing the first inode 3 Read Inode 2 (the root directory/ top of the filesystem) -- the length of each inode is given in the Group Descriptor 4 Traverse the filesystem as shown above to locate the file and its contents/ data blocks
    I have some code below that reads the file in one go.
       try { aFile = new RandomAccessFile("ext2fs", "r"); FileChannel fileChannel = aFile.getChannel(); long fsize = fileChannel.size(); ByteBuffer buff=ByteBuffer.allocate(1024); fileChannel.read(buff,1024L); buff.flip(); byte[] data = buff.array(); System.out.format("%s\n", new String(data)); buff.clear(); fileChannel.close(); aFile.close(); }  catch (IOException e) { System.out.println("File not found"); } here
    Thanks

    The best solution is that you redesign your program so that it does not depend on the order of the entries in the properties file.
    If you really want to stay with your design, you will have to read the properties file yourself, line by line, just like you would read any other text file, and parse the content of each line yourself.
    BufferedReader in = new BufferedReader(new FileReader("stuff.properties"));
    String line;
    while ((line = in.readLine()) != null) {
        // Parse the line, use e.g. String.split() to split it around the '='
    in.close();

  • How to read contents of a spool?

    hi
       any fm to read the contents of the spool by giving a spool req. no? i want to know before processing a spool whether it has some contents or is null ('List contains no data')..how to know this? any help is appreciated
    Regards,
    Sathish. R

    Hi,
    You may need to first call function module RSPO_RINIT_SPOOL_SP01 which contains the statement ASSIGN DUMMY2 TO <FSPORQ>. Since RSPO_RINIT_SPOOL_SP01 is in the same function group as RSPO_ROUTPUT_JOB, the assignment will remain when you call RSPO_ROUTPUT_JOB.
    See module pool RSPOSP01NR, form DISPLAY_OUTPUT_REQUESTS for an example of the use of RSPO_RINIT_SPOOL_SP01.
    Check this  <b>RSPO_RID_SPOOLREQ_DISP</b>
    Regards

  • How to read content of Microsoft Word to Webdynpro

    I always find to read the content of a doc to OfficeUIComponent is not difficult, but I wonder if I can get the plain text from the doc.
    I guess they read bytes from doc files can only display in OfficeUIComponent, these bytes can not be print out to console.
    So give me hint if Webdynpro can get plain text from doc file
    Thank you.

    @Anil: The problem will be, you wont be able to identify the text in Word by the ByteStream that we are getting.
    @William: There is no standard way to do this but I sugesst you use <a href="http://jakarta.apache.org/poi/hwpf/index.html">this</a> APIs for reading MS Word file.
    Thanks and Regards,
    Mausam

  • How to read contents of a file version using version url

    Hi,
    I have a file in a document library say "MyFile.txt". Versioning is enabled and there are three version of it
    What i want now is that , by passing the url of version i got from SPFileVersion class, i must be able to read the contents of it.
    Can anyone pls help me
    Arjun Menon U.K

    You can use the following line of code to get the content of a specific version
    SPFolder fld = web.Folders["Documents"];
    SPFile file = fld.Files["Documents/MyFile.txt"];
    //specific version
    SPFileVersion version = file.Versions[1];
    //Get the data
    byte [] dBytes = version.OpenBinary();
    Refer to the following posts for more information, hope it helps
    http://blogs.msdn.com/b/karthick/archive/2006/03/28/563045.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8d2619bf-34e9-421b-85c1-792b2a9e8ae9/spfileversioncollection-specific-version?forum=sharepointdevelopmentlegacy
    --Cheers

  • How to read data over tcp/ip using labview

    Hi,
    I have a network enabled force transducer (6-axis load cell). I know its IP addr. and the data format it is sending the data out (7 32-bit DWORD, One status and 6 axis force data) . I have been playing around with the simple data client.vi example program. 
    When I executed the program using the devices IP addr. I used to get error 63: TCP/IP connection open. Then I ran the program using localhost in IP addr field, the program executes now indefinetly at one block only. I am attaching the screenshot for ref. 
    Thanks.
    Sasi.
    Attachments:
    TCP-IP.JPG ‏62 KB

    Hello,
    I'm wondering if you can create a rather simple VI that just tries to open and close a TCP connecting to your transducer. All you would need is a TCP Open and a TCP Close wired together with the proper IP address etc. Does this run? I did look to see if there was any NetFT information and I could not find anything. I feel that the problem lies in the communication protocol between your transducer. Another place to see if you can connect to it would be to try hyperterminal. You can access this in Windows XP by clicking Start»All Programs»Accessories»Communications»HypeTermina. Using this, you can try and connect to your instrument with TCP/IP outside of LabVIEW. You might also want to get in contact with the manufacturer to verify that third-party software can indeed communicate with it. There may be a specific set of instructions that need to be sent to the transducer in order to initiate the connection and then read from it. These may be in the form of serial commands that would need to be sent over TCP. What is the make and model of your transducer?
    -Zach
    Certified LabVIEW Developer

  • How to read content of outlook express

    want to content in simple readble format
    Hi,
    Message message = folder.getMessage(messageNr);
    System.out.println("Message number: " + message.getMessageNumber());
    System.out.print("From: ");
    System.out.println((InternetAddress) ((DBXMessage) message).getFastFrom()[0]);
    System.out.print("Subject: ");
    System.out.println(((DBXMessage) message).getFastSubject());
    System.out.print("Content:");
    System.out.println(((DBXMessage) message).getContent());
    getting output in form
    message number: 1
    From: Alok Mishra <[email protected]>
    Subject: this is testing mail
    Content:javax.mail.internet.MimeMultipart@291aff

    http://java.sun.com/products/javamail/FAQ.html#mainbody

  • Has anyone figured out how to read pdfs online when message says Internet Explorer stopped working?

    I can't open any links to a PDF from within a website. Has anyone figured out how to fix problem of not able to read pdfs online? I get message that says I"nternet Explore has stopped working". ANY ideas?
    Message was edited by: base1fan

    Hi,
    It may be that you will need to 'reset' Internet Explorer, but you can certainly check if this issue is being caused by an add-on as follows.
    Click the Start Menu, open All Programs, open Accessories, open System Tools and click on 'Internet Explorer (No Add-ons)'.  See if Internet Explorer now runs correctly.
    Let me know.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • Reading contents of asm through shell script

    How to read contents of asm through shell script?
    Please paste one small example also.
    Thanks
    Bala

    Hello Bala,
    The ASM contents is not visible from the operating system or its utilities. Only visible to database instances, RMAN, and other Oracle-supplied tools.
    Please see http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/glossary.htm#sthref4105
    Regards,
    Rodrigo Mufalani
    http://mufalani.blogspot.com

Maybe you are looking for