Writing a virus with java

How can i write a virus with java for the sole purpose of testing my networks virus protection software?

Yes, you can write viruses in Java, but I'm not going to tell you how... ;-P
No, seriously, it can be done, but these viruses are generally limited to infecting other Java programs. Think the applet sandbox is safe? Like hell is it! There are a lot of flaws in various VMs that you can exploit by the modification of existing class files. Then there is monkeying with JARs, and so on. It is certainly possible to do it, but since Java has limited potential to access the OS, there is not a great deal you could do about infecting it.
The most effective viruses nowadays take advantage of human weaknesses rather than OS holes, so you could still use that in Java. However this it not ostensibly what you want to test.
Copy the following (exactly) into a text file, and rename it to something .COM :
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
This is not a virus, and is completely harmless, but it is executeable and should trigger most anti-virus systems.
When executed, it should print the line:
EICAR-STANDARD-ANTIVIRUS-TEST-FILE!
This assumes you are running windoze. For other platforms, I cannot help you.

Similar Messages

  • Writing Illustrator scripts with Java not javascript

    Hi all, I am an experienced Java developer, I want to ask about can I write scripts in Adobe Illustrator with Java rather than javascript, I mean Did Adobe make Java API for Illustrator?
    Thanks

    Hello,
    1) no, but c++, called plugin API ( Java Native Interface ? )
    2) maybe ask here for plain Java binding : http://scriptographer.org/news/a-new-release/  (written in java) ?
    chris

  • Writing Programs with java in 10.3.9

    So, I'm trying to teach myself the basics of Java. Here's what I did:
    I went to the apple website and poked around until I found what I THOUGHT was the right download. (JavaForMacOSX10.3Update5.pkg). This SEEMS to have created a Java folder (Applications/Utilities/Java) However I can't confirm that it wasn't there before I downloaded and ran the JavaForMacOSX10.3Update5.pkg. Inside this folder are four applications (Applet Launcher, Input Method HotKey and two other PlugIns).
    After reading a bunch of stuff about Java it seemed like I needed to be working with the Terminal Application in order to do command line stuff. I wrote a little program in TextEditor, saved it as "HelloApp.java" (like the book told me to) and then went to Terminal to try to compile it.
    When I open Terminal, here's what I see:
    Last login: Tue Jun 10 19:29:19 on ttyp1
    Welcome to Darwin!
    [Peter-Booths-Computer:~] peterboo%
    I typed in <javac HelloApp.java> and here's what I got back:
    error: cannot read: HelloApp.java
    1 error
    [Peter-Booths-Computer:~] peterboo%
    Sooo... my questions:
    How do I tell the computer through command line entries exactly WHERE my HelloApp.java file is? On a PC, they do something like cd C:/ to change directories to the location where the file is saved. Is there an equivalent command on a Mac?
    I'm not even sure that I've got the Java JDK or JSE or whatever the heck it's called on my computer. Can someone tell me how to figure that out?
    Is there a slicker way to compile, run etc. code with Java beside command line stuff in Terminal?
    Thanks a TON to anyone who can help me.
    Peter Booth
    Message was edited by: Peter Booth1

    Specify the path in the Terminal; a path will look like ~/Desktop/HelloApp.java if the item is on your desktop; when starting a path, ~ refers to your home folder, while / refers to the top level of the drive. Using 'cd' followed by a path will take you to that location from your current folder unless the path starts with a ~ or /, which work as above.
    A path which starts with ../ refers to the folder enclosing the one you're currently looking at.
    (32782)

  • Is there a way to create/edit registry keys with Java?

    I'm writing a console app and I'd like to have it so the users can change values in the registry. I'm not just talking about app keys I want any key. Is there a way to do this with Java?

    Maybe a forum search on "Windows registry" would turn up some useful things. You're not the first to ask this. You might save yourself and everyone else some time if you'd simply do that.

  • I can't open or save file with Java Web Start

    Hi,
    i can't open or save file with Java Web Start:
    import java.io.*;
    import java.util.*;
    public class MetaDataFileCreator {
    public String fileNameSpace = null;
    public String fileName = null;
    protected Properties file = null;
    public MetaDataFileCreator(String fileNameSpace, String fileName) {
    this.fileNameSpace = fileNameSpace;
    this.fileName = fileName;
    public void createMetaDataFile() {
    try {
    System.out.println("file METADATA");
    ClassLoader cl = this.getClass().getClassLoader();
    String nameFileMetaData = fileNameSpace + fileName + ".txt";
    FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
    file = new Properties();
    file.setProperty("aaaaa", "aaaa");
    file.store(fileOS, "");
    fileOS.close();
    } catch (Exception e) {
    System.out.println("Error writing metadata-file: " + e);
    System.exit(1);
    e.printStackTrace();
    I have try also to open a file like this:
    ClassLoader cl = this.getClass().getClassLoader();
    file.load(cl.getResourceAsStream(nameFile));
    also like this:
    try {
    fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
    fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
    } catch (UnavailableServiceException e) {
    fss = null;
    fos = null;
    System.out.println("Error with JNLP");
    System.exit(1);
    if (fss != null && fos != null) {
    try {
    // get a FileContents object to work with from the
    // FileOpenService
    FileContents fc = fos.openFileDialog(null, null);
    //FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
    // get the OutputStream and write the file back out
    if (fc.canWrite()) {
    // don't append
    os = fc.getOutputStream(false);
    } catch (Exception e) {
    e.printStackTrace();
    also like this:
    File f = new File((System.getProperty("user.home")+"x.txt").toString());
    FileOutputStream fileX = new FileOutputStream(f);
    OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
    OutputX.println(....
    but it doesn't work with Java Web Start.
    Can someone help me?
    How can I open or save file?
    thank you.
    Sebastiano

    Did you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?

  • Connection refused with java, but not javaw

    I have a ServerSocket based program...listening on a port. It is really a very simple program. And I can run it with javaw. Then I can use another problem, for example, telnet to connect to that port, just to prove I can connect to that port. Everything is fine.
    Now if I run the exactly the same ServerSocket program with java, then I got the connection refused error.
    It is weird.
    Do you know why? Do you know a good socket troubleshooting tool on Windows? I am afraid of the viruses, so I haven't downloaded any free tools yet.

    You're right.
    The Norton personal firewall does not handle localhost to localhost correctly. I do all the tests on the same machine. The netstat -an shows the port is listening in either case. But now I know the firewall blocks one of them silently. No rule prompt was triggered. Worse, no logging produced for that particular access.
    Thanks. You've been very helpful.

  • Help with java mapping

    PI File adapter has a processing option u2018Empty-Message Handlingu2019 to ignore or Write Empty Files. In case there is no data created after mapping on target side then this option determines whether to write an empty file or not. But there is a catch to this option when it comes to using it with File Content Conversion which is described in SAP Note u2018821267u2019. It states following:
    I configure the receiver channel with File content conversion mode and I set the 'Empty Message Handling' option to ignore. Input payload to the receiver channel is generated out of mapping and it does not have any record sets. However, this payload has a root element. Why does file receiver create empty output file with zero byte size in the target directory?  Example of such a payload generated from mapping is as follows:                                                           
    <?xml version="1.0" encoding="UTF-8"?>                          
    <ns1:test xmlns:ns1="http://abcd.com/ab"></ns1:test>
    solution :
    If the message payload is empty (i.e., zero bytes in size), then File adapter's empty message handling feature does NOT write files into the target directory. On the other hand, if the payload is a valid XML document (as shown in example) that is generated from mapping with just a root element in it, the File Adapter does not treat it as an empty message and accordingly it writes to the target directory. To achieve your objective of not writing files (that have just a single root element) into the target directory, following could be done:
    Using a Java or ABAP Mapping in order to restrict the creation of node itself during mapping. (This cannot be achieved via Message Mapping)
    Using standard adapter modules to do content conversion first and then write file. 
    can someone help with java mapping that can be used in this case?

    Hi,
        You have not mentioned the version of PI you are working in. In case you are working with PI 7.1 or above then here is the java mapping code you need to add after message mapping in the same interface mapping
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class RemoveRootNode extends AbstractTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    public void transform(TransformationInput arg0, TransformationOutput arg1)
              throws StreamTransformationException {
         // TODO Auto-generated method stub
         this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
    In case you are working in PI 7.0 you can use this code
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveRootNode implements StreamTransformation{
         public void execute(InputStream in, OutputStream out)
         throws StreamTransformationException {
    // TODO Auto-generated method stub
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         if(docIn.getDocumentElement().hasChildNodes())
              docOut.appendChild(docOut.importNode(docIn.getDocumentElement(),true));
              transform.transform(new DOMSource(docOut), new StreamResult(out));
         else
              out.write(null);
    catch(Exception e)
    public void setParameter(Map arg0) {
    // TODO Auto-generated method stub
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    try{
         RemoveRootNode genFormat=new RemoveRootNode();
         FileInputStream in=new FileInputStream("C:\\apps\\sdn\\rootNode.xml");
         FileOutputStream out=new FileOutputStream("C:\\apps\\sdn\\rootNode1.xml");
         genFormat.execute(in,out);
         catch(Exception e)
         e.printStackTrace();
    The code for PI 7.0 should also work for PI 7.1 provided you use the right jar files for compilation, but vice-versa is not true.
    Could you please let us know if this code was useful to you or not?
    Regards
    Anupam
    Edited by: anupamsap on Dec 15, 2011 9:43 AM

  • How to create a ms-access table with java?

    hi all
    i've my application and i want to add the capability to creat an access file (.mdb) and then, via SQL , create a table, with many columns of many types, and with a primary key too.
    i know that it's also an SQL problem, but i'm searching for it everywhere
    thanx for your reply
    sandro

    Hi,
    It would have been much better if you had specified your development environment- the database driver class depends on which environment you are working with. Forexample, if you are working with vj++6 you can make use of the com.ms.jdbc.odbc.JdbcOdbcDriver class. If you are using IBM's Visual Age for Java3.5 you can find the sun.jdbc.odbc.JdbcOdbcDriver. Oneway or another you should have the .class for jdbc-odbc(usu they have the form: xxx:jdbc:odbc:JdbcOdbcDriver). Check all the packages that are available in your development environment that have the form xxx.jdbc.odbc.JdbcOdbcDriver.(And not clear what you know and what you don't - so I start from the very elementary steps)
    Anyways, What you have to know is that it is not possible to create databases (e.g. .mdb) directly from a Java application(as far as I know). What is possible is to create new tables inside an already created database and process queries based on those tables.In short what I am saying is : you need to have a DSN before writing applications that create tables.
    Follow the following steps to create DSN(for win2000):
    1)Go to the control panel and click the 'administrative tools'
    2)In the 'administrative tools' click to open ODBC(data sources)
    3)Click the 'add' button and choose 'Microsoft Access driver'
    4)In the DSN text field enter the dsn (e.g., Test)
    5)If you want to create a table in an already existing database choose select and select one. However, if you want to create a new database click 'create' and enter a name for your database(e.g. ExampleDB.mdb). If you do this successfully it will issue a successfull operation message.
    6)Click advanced and enter the login name(e.g. Albert) and password(e.g. mxvdk) for the database
    7)Click 'ok's to finish the operation.
    After the above three operations what you will have is an empty database(with no tables) named "ExampleDB.mdb" in the directory you specified.
    Now, you can write a java application that creates a table inside the database "ExampleDB.mdb".
    Check this out:
    import java.sql.*;
    public class Class1{
    public Class1(){
    String userName = "Albert";
    String password = "mxvdk";
    String dsn = "Test";
    String databaseURL = "jdbc:odbc:"+dsn;
    //This is just an sql table creating statement- have nothing to do with java
    String sqlCreateStmt = "CREATE TABLE StudentTable" +
    "(StudentID varchar(32) PRIMARY KEY," +
    "name varchar(30)," +
    "age int)";
         try{
         Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
         }catch(ClassNotFoundException eCNF){
              System.err.println("ClassNotFoundException:");
              System.err.println(eCNF.getMessage());
         try{
         con = DriverManager.getConnection(databaseURL,userName,password);
         stmt = con.createStatement();
         stmt.executeUpdate(sqlCreateStmt);
         }catch(SQLException e){
    System.err.println("SQLException:");
    e.printStackTrace();
         //insert one sample data
    insertSampleData();
    private void insertSampleData(){
         String sampleStudentID = "scr-342-tch";
         String sampleStudentName = "Tom James";
         int sampleStudentAge = 24;
    //This is just an sql table updating statement- have nothing to do with java
         String sqlUpdateStmt = "INSERT INTO StudentTable VALUES ('"+
                             sampleStudentID+"','"+
                             sampleStudentName+"',"+
                             sampleStudentAge+")";
         try{
              stmt.executeUpdate(sqlUpdateStmt);
              }catch(SQLException e){
              System.err.println("SQLException:");
              e.printStackTrace();
    public static void main(String[] args){
    new Class1();
    private Connection con;
    private Statement stmt;
    //This program runs perfectly in my VJ++6.0 (console application mode) and also in my IBM's
    //visual Age for Java3.5 (with sun.jdbc.odbc.JdbcOdbcDriver as my database driver)
    //If you are developing in another development environment, what you need to change is the
    //"com.ms.jdbc.odbc.JdbcOdbcDriver" in Class.forName("com...") stmt.
    //If you run this program more than once, it will issue 'tableAlreadyExists' message
    If you still experience the problem, pls be specific and repost!

  • Can i create an exetutable (.exe) program with java???????

    I would like to learn how i can create an exetutable (.exe) program with java.
    Is there any additional package which i should download or buy it?
    Also i would like to write files into CD's direct from my application.
    Is there any library which i must download or buy?
    Thanks!

    check out the free open source GNU gcj native compiler for Java to see if it will do what you want.
    http://gcc.gnu.org/java/
    for writing data files you could use java.io.BufferedWriter. For sound files, look in the javax.sound package

  • What are the limitations of Java,what cannot be done with Java?

    Hello.I want to ask, is there anything which cannot be done with Java related to computer programming ,does Java have limitations?

    BIJ001 wrote:
    You need a JVM to run Java applications.Usually yes but nothing prevents you from writing a compiler to compile Java sources right into native code.@Everyone: Sorry folks, I meant to say "Never say unequivocally that something cannot be done. Time will more than likely prove you wrong."... which I think you all got the gist off, despite what I actually said.
    @BIJ: Hmmm yep, so that sort-of brings writing a device driver in the Java language into the realms of practicality, except you'd still have to work-around the fact that Java is by design a device/OS idependant language, so one suspects that you'd probably end-up using to JNI to call a large and complex library of assembler (or something) functions, which actually do the work... hence you'd probably be better of in assembler, C, or indeed any "native" language, or combination thereof.
    Java excels at writing "large and complex business systems". Java pretty much sucks at writing "low-level CS stuff", which C (and assembler) both excel at... Hence some knowledge of both helps you pick the tool for the task, and create "complementary" layers of abstraction in your application, which (the theory goes) make it robust and flexible.
    I do think that it's interesting that Java excels in exactly the places where C is/was "undercooked".... I do sometimes wonder if that was by design; like the language designers intended them to be complementary tools or something.
    Cheers. Keith.

  • Never programmed with Java

    Hello
    I have never programmed with Java, and dont know, what i can do, I use PHP, but, i am only a novice at it.
    I was wondering, is it possable to get data from a page, and put it into an image? if there is no data from the page, it will ask for the data to be added, and this will update every so often?
    Also, Most of you know about google maps, where you can search for something, well, can i do this same thing in java, have a map, not of the earth, but for a game, and make it easy to add different parts, so that we can search for it, and people can find it easy to look for what they are looking for?

    I think Google Maps is programmed in JavaScript using AJAX (short for Asynchronous JavaScript and XML) and is what as known as a web application. Google has released an API (still in beta) for working with Google Maps. The webpage for this API is http://www.google.com/apis/maps/. More about the development facilities Google provides can be found at http://code.google.com/.
    I've never read the source code to Google Maps before (a lot of which is available by just viewing the source code of the Google Maps webpage, which can be done by clicking, View > Source in Internet Explorer and View > Page Source in Mozilla Firefox), however I don't think it is a terribly complex application (this does not mean, however, that the source code is easy to read). I think the way it works is by requesting individual images as needed from the Google server and piecing them together on the client side (i.e. in the browser). Basically what you would need to do to use their existing code is to replace all requests made to the Google server with requests to a server of your own and have the server return the corresponding images. This might not be particularly easy to do.
    In my opinion, a better approach is just to write your own custom application (probably in Java) which simply mimics the behavior of Google maps, except with your own custom images. This way, you don't have to reverse engineer an entire web application before beginning to write one.
    Writing your own application for this purpose is not as difficult as it sounds, especially not in Java. Once understanding the basics, you will not be too far off from being able to write your application.
    Let's start with the most basic program (this program would be located in a file called Program.java):
    public class Program {
       public static void main(String[] args) {
    }This program simply starts, does nothing, and exits. I will explain this piece of code line by line, but first, I would like to gauge how much you already know to figure out how best to explain this. Have you used classes in PHP before?

  • How to invoke a stored procedure on MS Sql Server with Java?

    I started writing Enterprise Java Beans and created an ODBC dsn with MS Sql Server 2000 which I can access using jdbc:odbc:mySqlDSN. This all works fine using Java Sql Statements. What kind of Java/Java Sql statement can I use to invoke a stored procedure on the Sql Server? Is it possible to use ADO/ADO command objects with Java? Is it possible to import/implement Mdac2.6 ActiveX data objects libary in Java?
    Thanks

    Thanks all for your replies. I will search the api for callable statements. I am curious though, the reply that suggests using a prepared statement - can I put the name of a stored procedure in a prepared statment or is this just suggestions an action query like Insert Into, Update, Delete? Like with ADO you can say
    cmdObject.CommandType = adStoredProcedure
    cmdObject.CommandText = "NameOfStoredProc"
    cmdObject.ExecuteNonQuery()
    Once I am calling/importing/implementing the proper libraries/interfaces in Java, can a prepared statement reference a stored procedure as above?
    Thanks

  • How can I compact a MSAccess database with java?

    Hi.
    I have a question (Please Help!!!):
    How can I compact a MSAccess database with java-jdbc? Is it posible?
    Thanks

    MS Access database has a max length limitation of 2.14GB for Access 2000( 1.07G for Access 97), and won't recycle basically space for update/delete sql so tha it's a good idea to use MS Access database for program, which need update/delete frequent ly data. The programmers of HXTT Access(www.hxtt.net) are writing code for CREATE TABLE/DATABASE sql now. If you need a pure Java solution for PACK TABLE/DATABSE urgently in your project, you should send such a requirement to the Support page of www.hxtt.net so that they can schedule complementing such a fucntion. Otherwise, you should pack your databae manually or visit C++ code for Compact an Access Database Programmatically at
    http://www.codeguru.com/Cpp/data/mfc_database/microsoftaccess/article.php/c4327/ , or use Easy Microsoft Access MDB MDE Compactor at http://www.easyhr.com.au/software/easy_mdb_mde_compactor.htm.

  • Domino Gateway Crash with Java.io.EOF Exception

    All,
    My client has IDM 7.1 provisioning to Domino 6.5.4. It has been working fine untill last friday. Since then the gateway is crashing with Java.io.EOF Exception while trying to provision. The code has not changed and per some of the previous threads in this forum, I checked if they had any configuration changes in the Domino gateway server or at the domino side - like virus scan etc. However the answer was no.
    I would really appreciate any help on this.
    Thanks,
    Biju.
    Here is the last few lines in the gateway trace before it crashes:
    27/2009 00.20.25.343000 [4924] (../../../../src/wps/agent/connect/main.cpp,247): Enter: doDominoInitialization
    03/27/2009 00.20.25.343000 [4924] (../../../../src/wps/agent/connect/main.cpp,271): NotesIniFileDir: D:\IDM\gateway\notes.ini
    03/27/2009 00.20.25.343000 [4924] (../../../../src/wps/agent/connect/main.cpp,279): NotesInstallDir: D:\notes
    03/27/2009 00.20.25.343000 [4924] (../../../../src/wps/agent/connect/main.cpp,291): Domino Enabled
    03/27/2009 00.20.25.343000 [4924] (../../../../src/wps/agent/connect/main.cpp,303): Updated PATH: ;D:\notes;
    03/27/2009 00.20.25.343000 [4924] (../../../../src/wps/agent/connect/main.cpp,310): NOTESNTSERVICE Successfully set
    03/27/2009 00.20.25.406000 [4924] (../../../../src/wps/agent/connect/main.cpp,327): Exit: doDominoInitialization
    03/27/2009 00.20.25.406000 [2752] (../../../../src/wps/agent/connect/ntsvc.cpp,95): Service::svc
    03/27/2009 00.20.25.437000 [2752] (../../../../src/wps/agent/connect/server.cpp,269): starting up server daemon PORT 9278
    03/27/2009 00.20.25.875000 [2752] (../../../../src/wps/agent/connect/RAEncryptor.cpp,128): Error reading encrpytion key from registry. Using default.
    03/27/2009 00.20.25.875000 [2752] (../../../../src/wps/agent/connect/RASecureConnection.cpp,64): RASecureConnection: new connection handler
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/client_handler.cpp,344): got 68 bytes
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,264): ReceivePrivate: count: 47, 64 wrapped up rawlength 63
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,273): Rightbefore decrypt:
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RAEncryptor.cpp,69): RAEncryptor::Decrypt3DES: input length (56) moded to 7
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,114): SendPrivate: count: 0 pad: 4
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,422): Enter: MakeChallengeResponse
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,474): MakeChallengeResponse(in,out):
    (5C,2F) (CC,56)
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,476):  (26,E3) (D7,65)
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RAEncryptor.cpp,128): Error reading encrpytion key from registry. Using default.
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,497): MakeChallengeResponse Key:
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,507): Exit: MakeChallengeResponse
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,114): SendPrivate: count: 16 pad: 4
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/client_handler.cpp,344): got 36 bytes
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,264): ReceivePrivate: count: 16, 32 wrapped up rawlength 32
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,273): Rightbefore decrypt:
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RAEncryptor.cpp,69): RAEncryptor::Decrypt3DES: input length (24) moded to 3
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,114): SendPrivate: count: 0 pad: 4
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RAEncryptor.cpp,128): Error reading encrpytion key from registry. Using default.
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,571): Session key :
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/client_handler.cpp,344): got 16036 bytes
    03/27/2009 00.20.25.875000 [3068] (../../../../src/wps/agent/connect/RASecureConnection.cpp,264): ReceivePrivate: count: 16012, 16032 wrapped up rawlength

    Workflow Trace:
                                  <List>
                                    <String>defaultPasswordExp</String>
                                    <String>365</String>
                                  </List>
                                </List>
                              </ResultRows>
                            </ResultTable>
                          </ResultItem>
                          <ResultItem type='error' status='error'>
                            <ResultError throwable='com.waveset.util.WavesetException'>
                              <StackTrace>com.waveset.util.WavesetException:
    ==> java.io.EOFException:
         at com.waveset.adapter.AgentResourceAdapter.getResponseBytes(AgentResourceAdapter.java:924)
         at com.waveset.adapter.AgentResourceAdapter.getResponse(AgentResourceAdapter.java:955)
         at com.waveset.adapter.AgentResourceAdapter.getResponse(AgentResourceAdapter.java:940)
         at com.waveset.adapter.AgentResourceAdapter.getResponse(AgentResourceAdapter.java:934)
         at com.waveset.adapter.AgentResourceAdapter.doCreateOrUpdateRequest(AgentResourceAdapter.java:1289)
         at com.waveset.adapter.DominoResourceAdapter.doCreateOrUpdateRequest(DominoResourceAdapter.java:1072)
         at com.waveset.adapter.AgentResourceAdapter.createAccounts(AgentResourceAdapter.java:266)
         at com.waveset.adapter.ResourceAdapterBase.createAccount(ResourceAdapterBase.java:832)
         at com.waveset.adapter.ResourceAdapterProxy.createAccount(ResourceAdapterProxy.java:213)
         at com.waveset.provision.ProvisionContext.doResource(ProvisionContext.java:2103)
         at com.waveset.provision.ProvisionContext.processOp(ProvisionContext.java:592)
         at com.waveset.provision.ThreadContext.processContext(ThreadContext.java:330)
         at com.waveset.provision.ThreadContext.launchThreads(ThreadContext.java:239)
         at com.waveset.provision.ProvisionContext.doResources(ProvisionContext.java:280)
         at com.waveset.provision.Provisioner.reProvision(Provisioner.java:2226)
         at com.waveset.provision.Provisioner.reProvision(Provisioner.java:1416)
         at com.waveset.provision.WorkflowServices.reProvision(WorkflowServices.java:2791)
         at com.waveset.provision.WorkflowServices.call(WorkflowServices.java:789)
         at com.waveset.adapter.RASecureConnection.access$700(RASecureConnection.java:53)
         at com.waveset.adapter.RASecureConnection$ReceiveThread.run(RASecureConnection.java:1080)
    Wrapped exception:
    java.io.EOFException
         at java.io.DataInputStream.readFully(DataInputStream.java:204)
         at java.io.DataInputStream.readInt(DataInputStream.java:380)
         at com.waveset.adapter.RASecureConnection.ReceivePrivateThread(RASecureConnection.java:540)
         at com.waveset.adapter.RASecureConnection.access$700(RASecureConnection.java:53)
         at com.waveset.adapter.RASecureConnection$ReceiveThread.run(RASecureConnection.java:1080)
    </StackTrace>
                              <ResultError throwable='java.io.EOFException'>
                                <StackTrace>java.io.EOFException
         at java.io.DataInputStream.readFully(DataInputStream.java:204)
         at java.io.DataInputStream.readInt(DataInputStream.java:380)
         at com.waveset.adapter.RASecureConnection.ReceivePrivateThread(RASecureConnection.java:540)
         at com.waveset.adapter.RASecureConnection.access$700(RASecureConnection.java:53)
         at com.waveset.adapter.RASecureConnection$ReceiveThread.run(RASecureConnection.java:1080)
    </StackTrace>
                              </ResultError>
                            </ResultError>
                          </ResultItem>
                        </WavesetResult>
                      </ResourceResult>

  • C++ can send a "struct" over TCP.How to do the same fuction with JAVA?

    as Title~
    C++ send a struct like the following...
    NEO_MSG neo_msg;
    struct NEO_MSG
    int iPortRecv; // port for recv data of client
    char verify;
    ////After create a TCP connection....
    send(ServerSock, (char*)&neo_msg, sizeof(neo_msg), 0);
    How to rewrite it with JAVA?

    If you are trying to do it in a way that is compatible with C++, then you'll need to write the bytes to the socket. You can do this by wrapping the socket's output stream with a DataOutputStream, then writing each value in order.
    Remember that a C++ struct is just a convention of accessing a linear array of bytes, so the above is equivalent.
    If you are just trying to send an Object's data over a socket (to another Java app), then you can wrap the socket's output stream with an ObjectOutputStream, then just write the object to it.
    - K

Maybe you are looking for