Aji Prasetyo

Ranch Hand
+ Follow
since Jun 13, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aji Prasetyo

I managed to get the IP address of target PC behind the gateway machine and the IP address of the gateway machine.
But from my PC I can't see the target PC's IP address.
I also heard of "Virtual Private Network (VPN)" to create a virtual connection using a public network such as internet. Is it applicable?
How can I setup VPN?

Thank you.
Hello guys,

I have an application that send and receive array of bytes. It can works under the same network by inputing the target PC's IP address and it's Port.
The problem is I want to send and receive with PC on other network. What IP address should I enter, because I can't see the target PC's IP address from my PC.

Thank you so much beforehand.
Now I can send a byte array from Java to C++ application using ByteArrayOutputStream class.
But when C++ returns the byte array back to Java, the following exception occurs:

at java.io.DataInputStream.readInt(DataInputStream.java:375)
at EchoJava.main(EchoJava.java:83)

Does anyone can tell me the mechanism of this exception or how this exception is called? Better yet, anyone can tell me how to avoid this kind of exception?

By the way this is how I send the byte array (from C++):

Please help and Thank you very much.

Please notice the code below, I want to send a byte array of integer array over local network to the receiving C++ application.

Before that I want to test my int to byte converter code. But I can't get the iteration code to iterate in order to get the int value.

But when I get it manually, it works. I can display the int value by changing the above code with this:

Anybody can tell me why I can't iterate?
Please help me. Thank you very much.

The complete code I am speaking of.

14 years ago
At below I have paste the C++ code (Server and Client). However I will not use the client-side code. Java applet will runs in the client-side.

Right now I still don't know how to send 2 dimensional array of integer to C++ application.
Could somebody tell me how to do this?

Thank you so much.

This is Server-side code:

This is Client-side code:

Why do you have the byte array requirement?

Because I need to send the byte array to C++ application. And as far as I know, C++ don't have serialized method.

Thank you.

Does anyone here know how to transport 2 dimension array of integer using byte array?

Thank you so much beforehand.
Hi guys, it seems that I have to take your time with my dumb question again

This time I am transporting various data types(int[][], int[], and boolean) through TCP/IP connection.
Last time I succeeded in transporting those data types using an object (I put all those data types into an object, provided the get/set implementation, and send the whole object).
The problem is that right now I am transporting the same data but between Java and C++ application. I've browsed the Internet but couldn't find the solution.

Has anyone around here ever tried to transport various data types from Java to C++ vice versa?
Could somebody give me some sample code regarding this matter.

Thank you very much. I am sorry for the trouble.
Thank you so much. But I am afraid I only understand about 10-20 percents of the solution you guys offered. Looks like I have a lot to study.

My problem about synchronizing is not about timing, but plainly about reading and writing of data queue. In my program there will be user commands that need to be executed by the C++. So the commands will be put into some kind of queue and C++ will executed it one by one accordingly.

This time, could somebody provide me with a sample code? Because it helps me a lot to understand.

I am sorry for my ignorance.
Dear guys,

I am not sure whether I should post it here or in the JNI forum. but I am not asking about native code, so I guess I am posting it here.

I have a stream of data, I write it into a file using FileWriter(). The problem is, the data in the file is suppose to be read by C++ application. How do you synchronize a file access with something which is not java (C++)?

If anybody familiar with the case, please help me.

Thank you so much beforehand.
Hello again...

Can anybody tell me what does

Software caused connection abort: socket write error


I am making a program to transfer data int[][] through socket connection. Both server and client side has exactly the same codes (of course I alter the destination computer name and port number for outgoing and incoming socket). The server and client each has 2 threads inside. one for sending socket, the other one for receiving packet.

I could attach the code I am working, but it's around 250 lines each. I am afraid it can be somewhat discouraging, Maybe in my next post But please don't misunderstand, I don't want to rush anybody.

thank you so much beforehand.
I am surely blessed by your answers. I am learning alot. Thank you so much.

One more thing, in practice for-instance I have a class named Master. Inside Master I have an inner class called InnerMaster. The innerMaster need a variable mVariable from Master. In this case should I make the variable static or not?

thank you.
14 years ago
I am sorry, but I am not quite sure what you mean.

blocks where threads interleave

But if you're asking about where the threads interleaves, then it is in the ScanDataPool class.

The readData and writeData method is both synchronized method. The mehod will wait according to the boolean variable refreshed. Please note that you have to toggle the boolean variable and at the end of the method you have to call notifyAll to tell the waiting method to go on.

I am sorry if my explanation is inadequate.