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

Similar Messages

  • Does Java2 support raw socket programming?

    Hi,
    Does Java2 support raw socket programming? If not, are there any third-party libraries providing such support? Thanks for any comments!
    Yong

    no,
    first result on google would suggest so.
    http://www.google.com/search?q=raw%20socket%20java%20lib&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8

  • File descriptor leak in socket programming

    We have a complex socket programming client package in java using java.nio (Selectors, Selectable channel).
    We use the package to connect to a server.
    Whenever the server is down, it tries to reconnect to the server again at regular intervals.
    In that case, the number of open file descriptors build up with each try. I am able to cofirm this using "pfile <pid>" command.
    But, it looks like we are closing the channels, selectors and the sockets properly when it fails to connect to the server.
    So we are unable to find the coding that causes the issue.
    We run this program in solaris.
    Is there a tool to track down the code that leaks the file descriptor.
    Thanks.

    Don't close the selector. There is a selector leak. Just close the socket channel. As this is a client you should then also call selector.selctNow() to have the close take final effect. Otherwise there is also a socket leak.

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

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

  • How to control tcp connection with java tcp socket programing ??

    Hi,
    I am connecting a server as using java socket programming.
    When server close the connection (socket object) as using close() method ,
    I can not detect this and My program continue sending data as if there is a connection with server.
    How to catch the closing connection ( socket ) with java socket programming.
    My Client program is as following :
    import java.io.PrintWriter;
    import java.net.Socket;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        try
                          socket = new Socket("localhost",5555);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            pw.println(i+". message is being send.");
                            Thread.sleep(5000);
        } catch (Exception ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

    I changed the code as following. But I couldn't catch the EOFException when I read from the socket. How can I catch this exception ?
    import java.io.BufferedReader;
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        BufferedReader bufIn=null;
        InputStreamReader inRead=null;
        InputStream in=null;
        try
                          socket = new Socket("localhost",5555);
                          in = socket.getInputStream();
                          inRead = new InputStreamReader(in);
                          bufIn = new BufferedReader(inRead);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            try
                              bufIn.readLine();
                              pw.println(i+". message is being send.");
                              System.out.println(i+". message has been send");
                            } catch (Exception ex2)
                              System.out.println(ex2.toString());
                              System.out.println(i+". message could not be send");
                            } finally
                            Thread.sleep(5000);
        } catch (EOFException ex)
                          ex.printStackTrace();
        } catch (InterruptedException ex)
                          ex.printStackTrace();
        } catch (IOException ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

  • A  Socket   Program Java

    Hello Dear Java Forums Team I'am Alfonso Franco who is reporting my socket program
    as http://www.javaworld.com without a port number assigned only the Input of www.javaworld.com more the following Code: System.out.printIn( " Enter a Host Name: ", + name) ;
    System.out.printIn( " Enter pin code number device: " + device) ;
    System.out.printIn( " Ours server is detecting a successfull connection " ) ;
    System.out.printIn( " Ours server sorry detect error didn't match name and number ") ;
    Please I'am looking for someone who will help me with my question is really this socket program works correctly if not give more reference to do it's improved . Thank you Team
    Alfonso Franco
    [email protected]

    Remove "if (input.ready())". readLine() will block, consuming zero cpu, until it gets data, EOF or an IOException.
    I've been programming sockets since mid-80's and I've never used something like socket.ready(). The normal way to do sockets is either to read() / readLine() or to select() / poll(). ready(), available() and such should come with big blinking warning labels.

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

  • Java Swing and Socket Programming

    I am making a Messenger like yahoo Messenger using Swing and Socket Programming ,Multithreading .
    Is this techology feasible or i should try something else.
    I want to display my messenger icon on task bar as it comes when i install and run Yahoo Messenger.
    Which class i should use.

    I don't really have an answer to what you are asking. But I am developing the same kind of application. I am using RMI for client-server and server-server (i have distributed servers) communication and TCP/IP for client-client. So may be we might be able to help each other out. My email id is [email protected]
    Are you opening a new socket for every conversation? I was wondering how to multithread a socket to reuse it for different connections, if it is possible at all.
    --Poonam.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with socket programming-connecting to port 13

    Hi, I am learning JAVA, and we are on the subject of sockets. I am trying to make this program to connect to port 13, get the time, and print it to the console. This is my code:
    import java.io.*;
    import java.net.*;
    public class temp {
         public static final int PORT = 13;
         public static void main(String[] args) {
              Socket s = null;
              String line = null;
              try {
                   s = new Socket("localhost", PORT);
                   DataInputStream sin = new DataInputStream(s.getInputStream());
                   line = sin.readLine();
                   if (line != null) System.out.println(line);
              catch (IOException e) {System.err.println("!" + e);}
              finally {
                   try { if (s != null) s.close(); }
                   catch (IOException e2) {}
    And this is the output:
    !java.net.ConnectException: Connection refused: connect
    What should I do. I found that the problem is with the server I am connecting to and I tried connecting to dif. computers, or to stuff online, and nothing works.
    Any suggestions for me?
    Forgot: I tried this on both a windows XP and Vista
    Edited by: xpatrickerx on Mar 23, 2008 8:12 PM
    Tampering with it, I find that the error occurs on the following line:
    s = new Socket("localhost", PORT);
    Edited by: xpatrickerx on Mar 23, 2008 8:13 PM

    So I finally found how to use printStackTrace and here is what it gives when:
    1) I use my own computer:
    java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at temp.main(temp.java:11)
    2) I use something else:
    java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at temp.main(temp.java:11)
    Again, thanks

  • TCP/IP socket programming in ABAP

    Hi,
    Is there any method of TCP socket programming in ABAP? For example is there any function module for creating a socket for a IP address and port number. After that, is it possible to send binary/text data to a connected IP/port destination. I need such a solution because I need to send raw data (native commans) to barcode printer on our network which has a static IP address and listens incoming data through a fixed port number specified in its documentation. For a solution, I coded some .NET VB and built a small application that acts as a RFC server program which can be called by SAP according to definitions I made in SM59 (I defined a new TCP connection and it works well sometimes!). In this application, data coming from SAP are transferred to the barcode printer. This is achived by the .NET Socket class library. This solution works well but after a few subsequent call from SAP, connection hangs! SAP cannot call the application anymore, I test the connection in SM59 and it also hangs, so I need to restart the VB application, but this is unacceptable in our project.
    As a result, I decided to code the program that will send data to the printer in ABAP as a function module or subroutine pool, so is there any way to create a socket in ABAP and connect to specific IP/port destination? I searched for possible function modules in SE37 and possible classes in SE24 but unfortunately I could not find one. For example, do know any kind of system function in ABAP (native commands executed by CALL statement), that can be used for this purpose?
    I would appreciate any help,
    Kind regards,
    Tolga
    Edited by: Tolga Togan Duz on Dec 17, 2007 11:49 PM

    Hi,
    I doubt that there is a low level API for sockets in ABAP. There is API for HTTP but probably that won't help you. As a workaround you can use external OS commands (transactions SM69 and SM49). For example on Unix you can use netcat to transfer file. Your FM needs to dump data into folder and then call netcat to transfer file.
    Cheers

  • Socket programming usin nio package

    hello frens i m new to socket programming
    i come to know that nio packaage provides more sophisticated and efficient API to deal with socket programming issue
    I need to know where i can get tutorial about socket programming using nio pacakage

    Try google
    http://www.google.co.uk/search?q=java+nio+tutorial

  • [Urgent]3G Socket programming

    May I use socket for 3G networks?
    I use the demo provided by the WTK2.5-Beta(NetworkDemo), it works well in the simulator. However, when I download the program to the mobile phone, it seems that the mobile phone that runs ServerSocket cannot create the socket ... all the 2 handsets use a 3G SIM card provided by a Hong Kong ISP smartTone ... What can I do?
    Please help~ provide any web page of codes, thanks very much!

    1.     We want to create a socket connection which can
    remain open and live for ever till it is closed. Is
    this possible in java socket programming?Yes, but it isn't practical in the real networking world. So your code had better be prepared to deal with network failures.
    2.     I am just wondering in order to communicate with
    the third party over the socket connection, does this
    other party requires to run something specific on
    their end? I am not able to understand how will my
    java code communicate with their server otherwise.It has nothing to do with java. Sockets send and recieve messages. The applications at either end, regardless of the language that they are written in, must handle those messages.
    3.     Can we send and receive data over the socket
    created and also is their specific format for the
    data? Yes.
    Can we send files of data over this connection?Yes. (Although I don't know why you would need to do that if you are doing credit card auths.)
    It would be great if someone can comment on these
    questions and also if possible please provide some
    code that can create socket connection.The tutorial.....
    http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

Maybe you are looking for

  • FAQ: Where can I find tutorials for Adobe SpeedGrade?

    Here are some tutorials to help you learn Adobe SpeedGrade: Learn to use Adobe SpeedGrade from Adobe Creative Cloud Tutorials. Adobe SpeedGrade tutorials on Adobe TV. Lynda.com SpeedGrade courses, with some free tutorials Getting Started With SpeedGr

  • Error while executing the BW  template from Enterprise portal.

    HI all, i need a help in resolving the  issue. when i am trying  to run the template(WAD) from Enterprise portal i am facing an error. the error message is as follows cannot load query ''query name'' (data provider "DP_1":) Notification Number RSBOLA

  • How can I get my OS X back to my MacBook Pro? Booted Widows 7 from a disc and have deleted all the partitions. :(

    Guys! I'm new to OS X and not used to it so I tried installing Windows 7 having the thought that it's as easy as on ordinary laptops. Installation was succesfull, Installed it by first going to a "boot utility like" screen while it's still on OS X, D

  • Dreamweaver code problem?

    Hi~ I am managing a web site that includes a shopping cart feature. Once an item has sold, we remove the code that allows users to add it to the shopping cart and move the product's page to a gallery of previously sold items. However, we have recentl

  • Iphoto Book -- client approval

    I'm designing an Iphoto book for a client and want to send them a versionto look over. I tried saving it as a PDF in Iphoto, but doing it that way loses the "book format" -- no drop shadows or outlines to show the book dimensions. It loses the effect