Raw Socket in Java

Hello everybody. Since 2 years ago, I was looking for the Java RAWSOCKET class, and I read that it was possible....Up to now I did not read nothing about this...So, when could I find the Java RawSocket? Many thanx...
Ivano

I talking to Java developers....but they didn't answer
me! I need a response... I wanna know why there is not
a Java Raw Socket Class....or a Java ICMP Socket (NOT
NATIVE, NOT IN C, NOT JNI, OK?). First of all the socket classes that already exist in java already DO use JNI. You just don't see it.
I know that icmp
socket require root privilege, but, for example, in
PDA or cellular phone (J2ME) it doesn't need about
root privilege to "make ping" (Icmp echo).
Will they answer me ? Hoping.....If you give Sun a lot of money then they will be happy to add almost anything you want to java.
But if not then Sun is going to add what they feel is important.

Similar Messages

  • Raw Sockets in Java

    Hi
    Is it possible to create raw socket like in C. In C, I am able to create a structure like below
    struct ipheader {
    unsigned char ip_hl:4, ip_v:4;
    unsigned char ip_tos;
    unsigned short int ip_len;
    unsigned short int ip_id;
    unsigned short int ip_off;
    unsigned char ip_ttl;
    unsigned char ip_p;
    unsigned short int ip_sum;
    unsigned int ip_src;
    unsigned int ip_dst;
    An then declaring a pointer to this structure enables me to create my own IP header. Adding up Ethernet, TCP and IP headers creates a data packet.
    I wonder weather is it possible to create a packet like this in Java or not?
    Thanks...

    Well, it is possible to create a structure like that. Sending it to the net will require OS-dependent JNI, though. And possibly special security permissions, depending on your OS.
    What are you really trying to do?

  • Why does not java support raw sockets?

    Java does not have support for raw sockets, that means it cannot receive the packet header, just the payload data.
    But the header data of an ICMP packet consists of 20 bytes, and you can still write single bytes in Java, so why isnĀ“t is possible to write a header for an ICMP packet in Java?
    Can someone explain how it all works?
    Thanks!

    You can do raw sockets with third party libraries. They won't be pure java - but you didn't really expect to do raw sockets on your cell phone or TV set top box, or spy and spoof someone's network using an applet.
    The FAQ for one such library hints what kind of a mess raw sockets are due to differences in common operating systems; see http://www.savarese.com/software/rocksaw/

  • Raw socket programming  is avilable in java

    hello,
    I want to reset my target device using device
    MAC address (not IP address).
    Is java support raw socket programming.
    can i send packets using MAC address in Java like C.
    I search in google. but, it shows there is no raw socket pgm support in java.
    any one help me this issue.

    JPCap

  • Future raw socket capability in Java?

    Is there raw socket capability with Java now? As I recall, Java only supports TCP and UDP sockets, right? I hope Java will include support for raw sockets, especially since Windows XP will support it as a standard.

    I agree; I wouldn't mind some restrictions (to prevent IP spoofing) but developers should definitely have access to the don't fragment bit, the protocol field and the entire payload. Sometimes neither TCP nor UDP will get the job done...

  • Java sockets and raw sockets

    Hello!
    I have made my own file sharing program with Java sockets
    and i have read a litle bit about raw sockets also.
    What are the differences between Java sockets and raw sockets?

    raw socket can have packet types which Java does not.
    Generally if you need something useful which Java cannot do there is a utility already written which does what you want, e.g. ping and you can call that.

  • Raw Socket Access

    I need to negotiate password hashes for Authentication: NTLM (opposed to BASIC) but this requires sending a message back to the client and receiving the hashes without closing the socket. There's a nice diagram of this handshake here:
    http://www.innovation.ch/java/ntlm.html
    Is there any way to basically bypass all HTTP connection control and get access to the raw socket so I can do this handshake?
    I have all the code worked into the new jcifs.http package but it doesn't work because sending back 401 Unauthorized implicitly closes the connection.
    Any ideas would be greatly appreciated,
    Mike

    I need to negotiate password hashes for Authentication: NTLM (opposed to BASIC) but this requires sending a message back to the client and receiving the hashes without closing the socket.
    This problem was indeed solved. The jCIFS jcifs.http package now has an NtlmHttpFilter, NtlmSsp class for creating custom MSIE HTTP Authentication modules, and a NetworkExplorer Servlet for browsing the WAN with your transparently negotiated credentials.
    http://jcifs.samba.org/

  • Raw sockets

    hi
    i have 2 questions;
    first:
    i want to design a network monitoring and packet capturing tool for my school project
    i read the related topics but i have still doubts,
    if i should use whether java or c . i dont know which one is better for such a tool.
    and second:
    do c and/or java raw sockets work under xp home edition
    thanks...

    you can in either, id suggest you just pick which language you are more comfortable in.
    In java you can use the JPCAP libraries to mornitor traffic

  • 4727550 Advanced & Raw Socket Support (ICMP, ICMPv6, ping, traceroute, ...)

    Hi All,
    4727550 was a long standing RFE. Before we take any action, I'd like to ask you guys what the requirements are. E.g., do you plan to use raw socket in what kind of application? What features do you want the most? Which platform do you plan to use? etc.
    Feel free to add your comments here.
    Thanks,
    Edward

    sjasja wrote:
    Its sad to realize at different occasions, that Java
    is just not usable for this type of application, e.g.
    writing a firewall...Sure it is! You just need some glue between operating system specific APIs and Java.
    This is not really a language issue. It's an issue of what language APIs a given OS supports out of the box. Want to write a firewall using C and deploy it on a LISP machine? Be prepared to write some C/LISP glue, just like you'd write Java/C glue to access APIs written in a C-based OS.
    C is so widespread, and so many OSes offer C APIs that C seems "universal". But that's just an illusion. The OSes that happen to be most popular at this time in history happen to provide C APIs to most of their functionality (even then you may occasionally need C/assembly glue for some things).
    More and more APIs, such as low level TCP access, will eventually migrate to Java. But ther is no "universal" language, magically able to access any API written in any other language.I think you are missing the point. In order to write a firewall in Java, you have to have raw socket support - IE: be able to specify the data going over the transport. Java currently supports TCP and UDP, but does not support any others (IPX, ICMP, etc).
    The reason these things are not available at the Java layer is because the underlying C code in the JVM is specifying the constants to pass to the socket library at the C level rather than letting the Java layer pass those parameters down. You can currently do it yourself by doing a bootstrap replacement for the JVM classes, or using a 3rd party library -- but you shouldn't need to. The underlying library should be rewritten as raw socket, and allow the existing libraries to be built as pure-java implementations on top of it.
    The reason that raw sockets were not around to begin with was that everyone was afraid it was a security risk. It is unfortunate that in order to protect us, they keep us from writing security software.
    As a side note, I think these two comments on the bug ( http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4727550 ) are interesting:
    4093850 "ICMP protocol support a.k.a. PING applets" was a long
    standing RFE seeking ICMP/raw sockets support. It attracted approximately
    250 votes on the JDC. It became clear from the feedback to the RFE
    that there were broadly two requirements :-
    In about one month (from 2006-08-23 to 2006-09-20), we don't see enough input in the SDN forum thread for this RFE. Seems there's no enough interest for it.
    If it "became clear" that people wanted this functionality, why post a brand new link somewhere and monitor it for one month to determine if anyone wanted the functionality. I didn't even know about this link until a friend mentioned that the bug had been updated.
    So, enough of a rant. I think that if we could write a full-fledged software firewall in Java without using a 3rd party library or JNI, then we'd be on the right track for requirements.

  • Panic with Raw Socket-Page fault in module "ip" due to a NULL pointer deref

    I see a panic when using raw sockets with Solaris 10 10/09 (u8). I included a sample program that can cause this issue (panic happens when a udp datagram is received on port 60000). This sample code works as expected with the previous version I was using - 5/08. If I bind with a port number of 0 I don't see the panic but I don't receive anything either.
    I believe I have all the latest patches installed. I'd appreciate any assistance in resolving this. Thanks...
    ^Mpanic[cpu11]/thread=fffffe8000916c60:
    BAD TRAP: type=e (#pf Page fault) rp=fffffe80009166c0 addr=83 occurred in module "ip" due to a NULL pointer dereference
    sched:
    #pf Page fault
    Bad kernel fault at addr=0x83
    pid=0, pc=0xffffffffedf86a10, sp=0xfffffe80009167b0, eflags=0x10246
    cr0: 8005003b<pg,wp,ne,et,ts,mp,pe> cr4: 6f8<xmme,fxsr,pge,mce,pae,pse,de>
    cr2: 83 cr3: 1a345000 cr8: c
    rdi: ffffffffa7092808 rsi: ffffffffb0094e00 rdx: ffffffffa73c9d40
    rcx: 0 r8: fffffe8000916878 r9: fffffe8000916880
    rax: 0 rbx: ffffffffb0094e00 rbp: fffffe8000916800
    r10: ffffffffa7c18840 r11: ffffffffa73c9d40 r12: fffffe8000916880
    r13: ffffffff9b314000 r14: ffffffff9a70b000 r15: 0
    fsb: ffffffff80000000 gsb: ffffffff9c52d800 ds: 43
    es: 43 fs: 0 gs: 1c3
    trp: e err: 0 rip: ffffffffedf86a10
    cs: 28 rfl: 10246 rsp: fffffe80009167b0
    ss: 30
    fffffe80009165d0 unix:die+da ()
    fffffe80009166b0 unix:trap+5e6 ()
    fffffe80009166c0 unix:_cmntrap+140 ()
    fffffe8000916800 ip:ip_udp_check+b0 ()
    fffffe80009168b0 ip:ip_udp_input+15a ()
    fffffe80009169d0 ip:ip_input+c7c ()
    fffffe8000916aa0 dls:i_dls_link_rx+32e ()
    fffffe8000916af0 mac:mac_rx+71 ()
    fffffe8000916b90 bnx:bnx_recv_ring_recv+113 ()
    fffffe8000916ba0 bnx:bnx_rxpkts_intr+17 ()
    fffffe8000916bc0 bnx:bnx_intr_recv+58 ()
    fffffe8000916bf0 bnx:bnx_intr_1lvl+120 ()
    fffffe8000916c40 unix:av_dispatch_autovect+78 ()
    fffffe8000916c50 unix:intr_thread+5f ()
    EXAMPLE USED TO CAUSE ABOVE PANIC
    #include        <unistd.h>
    #include        <stdio.h>
    #include        <stdlib.h>
    #include        <sys/socket.h>
    #include        <arpa/inet.h>
    #define BUFFER_SIZE 2048
    int main(int argc, char *argv[])
            int                     i, j, sd, iosize;
            char                    *ipbuffer;
            struct sockaddr_in      saddr, daddr;
            ipbuffer = calloc( 1, BUFFER_SIZE );
            //if ( ( sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) ) < 0 ) {        // Works
            if ( ( sd = socket(PF_INET, SOCK_RAW, IPPROTO_UDP) ) < 0 ) {            // Fails
                    perror("socket() error");
                    exit(-1);
            saddr.sin_family = AF_INET;
            saddr.sin_addr.s_addr = inet_addr( "0.0.0.0" );
            saddr.sin_port = htons( 60000 );
            if ( bind( sd, (struct sockaddr *) &saddr, sizeof( saddr ) ) < 0 ) {
                    perror("bind() error");
                    exit(-1);
            printf( "Awaiting inbound datagrams...\n" );
            for ( i = 1; i <= 10; i++ ) {
                    j = sizeof( daddr );
                    iosize = recvfrom( sd, ipbuffer, BUFFER_SIZE, 0, (struct sockaddr *) &daddr, &j );
                    printf( "Received %d bytes from %s\n", iosize, inet_ntoa( daddr.sin_addr ) );
            close( sd );
            return( 0 );
    }------------------------------------------------------------------

    This issue could be related. Recommend you open a call with support.
    http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6882984

  • Raw sockets with IP headers in mac osx

    I am trying to send IP packets through a raw socket (SOCK_RAW) on my mac (osx 10.6), and always get an "Invalid Argument" error. I have tried with IPPROTO_RAW, IPPROTO_UDP, and IPPROTO_DIVERT (which should also send raw packets). When using _RAW or _UDP, I also set the socket option for including ip headers with setsockopt(.., IP_HDRINCL, ..). Has anyone successfully sent IP packets with a raw socket on a mac that includes IP headers? Any example code I can use as a reference? Thanks!

    Well, in case anyone ever has the same issue, the only way I was able to inject packets back with my own IP headers was by writing to a bpf socket, which is not the prettiest way, but works. I am still interested in seeing IP_HDRINCL work on a raw socket, so if anyone has an example that works, please post!

  • AF_UNIX socket with java

    Is there any way to use unix domain sockets with java ? Is it level of socket abstraction implementation to high ? I guess it's not possible to use such functionality without JNI, but if so i'll be very happy. If it's not possible to do it without JNI can you suggest some libraries ?

    I really don't understand your question because based on my rudimentary socket knowledge a AF_UNIX socket is a Java socket when you are running on a Unixy system.
    No?
    Because Uniz sockets have two flavours socket stream (which I believe is the standard Java Socket) and datagram thingies (which are also available as DatagramSockets in Java)
    So is there something I am missing here? Are these like interprocess pipes? Sorry if I am clueless but I don't understand what you are asking.

  • Using Apache Commons HTTPClient to create a custom socket for Java mail

    Does anyone know how to use Apache Commons HTTPClient to create a custom socket for Java mail. This is necessary for me to use NTLM authentication

    JavaMail doesn't use HTTP.
    If you want to add support for NTLM authentication to one of the standard protocols,
    your best bet is to create a SASL provider, although note that only JavaMail's IMAP
    provider uses SASL currently. The other protocols should add SASL support, but that
    hasn't been done yet.

  • C# socket and java socket

    hello
    i am a java programmer,recently we got a project,that need the c# app to communicate with java app ,i select the socket as intermediate.
    i notice that java socket term is divided into " blocking" and "non-blocking",the latter come from jdk1.4, the c# socket is devided into "synchronized" and "asynchronized" and both of them are blocking,
    in my project,i have tried synchronized c# socket coorperating to blocking java socket,it works well..but when i modify the c# app to ASYNCHRONIZED socket,my system DON'T works well,i don't know why? i can't find asynchronized socket in java,.i learn that nio socket is nonblocking, is it asynchronized?
    who can tell me what's is the best solution for the socket communication between java and c#?

    yes,i have read them,but it only tell me the communication between java apps,and DON'T tell me any clue about c# socket.

  • Raw Sockets and Root Administration

    I've been reading the DOS articles on grc.com. Quite a cool website with lots of interesting information.
    I was wondering if there is a way to remove raw socket support from the kernel. I assume that that must be where that support is implemented, and I'm wondering if a way to prevent ip spoofing and other abusive techniques has been developed. The articles on grc.com are unclear as to whether the raw sockets support is required for ICMP, but it seems as though it is required. Basically, is there a way to prevent ip spoofing in the linux kernel?
    Also, it is mentioned that *nix tries to minimize abuse of the raw sockets system by only allowing the root user to make use of it. How would one go about setting up another user to administrate the system? The default way would seem to be setting up sudo access, but then you're basically giving that user root privileges for everything, which really doesn't seem to solve this problem to me.
    My understanding of this is somewhat limited, but I like to think that I comprehended the information about all this. If I have something wrong, tell me, I'm not one of those idiots that refuses to be told he is wrong.

    Could you please clarify me whether you could finally execute your program or not?
    I am also facing the same kind of problem.
    I have some RAW socket user level SCTP implementation which I am trying to run on SOlaris 10.But when I run user level SCTP program, its giving always "Cann't assign Address" i.e ERRNO : 126.
    Any clue from everybody...

Maybe you are looking for

  • Cannot connect to remote speakers using Airport Express

    Yesterday I was able to connect to my hi-fi using remote speakers in iTunes 6.0.4 through my Airport Express (AE) and take full advantage of Front Row, however later in the day the speaker selecton pop-button in iTunes disappeared. I did a hard-reset

  • MRKO  - Consignment and Pipleline Settlement

    Hi friends, User got this error when he is running MRKO. Received error message F5727 (see below) regarding limited number of transactions per settlement. Please alter process to allow for up to 9999 records per settlement -I do not want to increase

  • NodeList.item(i) returns every other child node

    I have used the following code to eliminate null elements from a Node. But somehow NodeList.item(i) only returns every other child node. The original Node (retNode) is: <getHearingDetailsByCaseNoWSResponse><hearingDetailsVO xmlns="http://vo.cis.com">

  • Trouble with serial number for upgrade install

    I am trying to upgrade from photoshop cs2 to cs4 with a purchased upgrade disc (on my imac). The installer requested my cs2 serial number and it is telling me the serial number does not match the product. I know for a fact this serial number does mat

  • Add or edit Sequence Call step(s) dynamically in a sequence

    Hello I have looked at the TestStand Example: SequenceBuilderTool In the <TestStand>\Examples\SequenceBuilderTool Folder It works great, but I cannot seem to be able to use this for a Sequence Call Step. Any Solutions? Thanks BRI NI