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.

Similar Messages

  • Problems with sockets and InputsStreams

    Hi,
    I ve this code:
    InputStream is = null;
    boolean ok=true;
    while(ok){
    //sc is an object instance of socketConnection
    is = sc.openInputStream();
    return this.parse(is);
    //is.close();
    return "";
    and this exception is produced:
    java.io.IOException: no more Input Streams available.
    This exception is produced in the line:
    is = sc.openInputStream();
    I m connecting to a server and this server sends data throw a socket... but the problem is that when i m reading from this socket and this socket doesn t have data in it...
    how could i solve this problem...?
    Thanks,
    Diego

    That would be the "real" code:
    public String process()throws IOException{
    InputStream is = null;
    is = sc.openInputStream();
    String result= this.parse(is);
    is.close();
    any suggestions?
    Thanks,
    Diego

  • 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 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?

  • 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.

  • 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...

  • Error in the Socket Communication between Java Client and VC++ Server

    In my application, using Java Client to do socket bi-communication with VC++ Server, which is done by somebody else.
    The error is after the application properly running one or two days, the VC++ Server cannot receive the messages passed by java Client, but at Java client, everything is the same, although using CheckError() after every print(), there is no exception thrown.
    The JVM is jdk1.3.1, platform is Win2k Server.
    The outputstream is PrintWriter().
    Please help me to settle down this problem. Thanks in advance.

    I read some thread in the forum, and found somebody had the similar problem with me. Just want to know how to settle this problem.
    In the client/server program. Client is a JAVA program and Server a
    VC++ program. The connection works, and the problem appears after some time. The Client sends a lots of requests to Serverm, the server seems receive nothing. But at the same time, the server is able to send messages to Client. The Client also can get the messages and handle them. Don't understand why there this problem and why it appears when it wants.
    The client is a Win2k platorm with JDK1.3.1 and the server is also a Win2K platform with VC++ 6.0.
    In the Client, using:
    inputFromServer = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    outputToServer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
    Hope can get your help.

  • Java WD and Socket Communication

    Hi,
    Is it possible to use Java Socket Communication with Java Web Dynpro. Or if not what is the best approach to have a Java Socket program integrated with a Web Dynpro Communication.
    Basically, I have an application which provides API for communication via Java Sockets.And this needs to be integrated in our SAP application.
    Thanks,
    CD

    Hi,
    You are currently using JCO to "Connect to a Remote System" - JCO will connect to a back-end with the main purpose of "executing BAPI's" in it.
    When you move to WebDynpro, you have what SAP calls Adaptive RFC Model - this will create a "Model Entity" in you WD Project that will do the same thing your JCO does.
    Assume your JCO now calls "BAPI_GET_FLIGHTS", to return the Flights that are currently available - In your newly create WDP Project, you will manually specify what back-end you wanna use when "Importing" and you will tell also the BAPI name. WDP will generate the class structure that you need in order to execute that function.
    JCO is what SAP created to execute BAPI's. JCO can be used by any "Java" like application that needs to connect to the back-end. But when you move to WDP, you don't need to use this anymore - You will use WDP Models.
    Youi will still need your JCO Destinations created in the Application Server, so behind the scenes WDP creates a "layer" so you don't need to code the JCO calls manually.
    Regards,
    Daniel

  • 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

  • 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...

  • Raw Socket always drop packets and return Destination Unreachable

    Ho folks,
    I have an application program that opens a raw socket to expect for UDP message incoming from the network.
    However everytime I receive a package the Solaris 10 OS return a ICMP - Destination (port) unreachable, and no message
    is send to my application.
    I did test the same application in linux and it worked well, all that I have to do was disable ICMP responses using iptables.
    Just to make things clear:
    In linux the OS was sending the ICMP - Destionation (port) unreachable, however my program was
    receiving the packets anyway. So just to stop those messages I did use the iptables. However, in
    Solaris 10 the ICMP response is sending back and no message is forward to my application.
    Would your guys help me to solve that?
    Thanks in advance

    Folks, here I go again...:-)
    I have been spent some time, trying to figure out why it is not work. I read in books and internet, that BSD raw sockets DO NOT allow us to receive TCP/UDP packages. However the linux implementation DOES allow. That is because it work in linux but not in solaris.
    Given that, such information is 100% true (book: Unix NetworkProgramming, 3rd edition), I would like to ask your guys what I can do to solve my problem.
    Basically what I need is create an application that:
    1) Allows to bind thousand of sockets at the same time (it is a media server that handles thousand of RTP connections)
    This I believe I can do using socket multiplexing (e.g. select() )
    2) Read not only the packet data, I need to retrieve the whole packet address (including IP, UDP, Upper Layers...)
    When using SOCK_DGRAM with IPPROTO_UDP, I can get the messages but I can't get the IP header
    3) Uses something like raw socket to send messages, here I believe I can use raw socket with no problem, is just sending messages
    Thanks and Regards

  • Java sockets and winsock

    when I use java socket to talk to my proxy, without going through a winsock, my java applet runs fine. However, when I patch winsock in between my java gui and my other proxy, I dont receive anything in the gui. I snoop at packets coming from my other proxy through winsock to my gui and the data is all there. I just cannot receive it.
    I use java class DatagramSocket() to establish a socket connection and use class DatagramPacket to get the packets coming. This works if I dont go through a ms proxy.
    Can anyone tell me why?

    How can you snoop at packets comming? I need to know so bad. :-)
    Thank you

  • 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

Maybe you are looking for