I am writing a networked application in Java, to communicate between the Client and the Server I am using Serialized objects to represent data/commands and sending them through object output/input streams.
I ... |
I have these three classes:
Command:
package pack;
public abstract class Command impements java.io.Serializable
{
public abstract void execute();
}
Client:
package pack;
// imports....
public class Client
{
Socket socket;
// ...
|
I have written an EchoServer that responds with the String ack if the data have been send accordingly.
My client looks like this... In order to receive the ack answer from the ... |
I'm trying to do local IPC using Sockets and Object streams in Java however I'm seeing poor performance.
I am testing the ping time of sending an object via an ObjectOutputStream to ... |
I have a fairly complex project that boils down to a simple Client / Server communicating through object streams.
Everything works flawlessly for two consecutive connections (I connect once, work, disconnect, then ... |
I have created a basic Client Server that will send image files in a specified directory over a network. The code worked last week but I came back to it today ... |
This is the code that i used on client socket
Socket connected = Server.accept();
ObjectOutputStream oos = new ObjectOutputStream(connected.getOutputStream());
oos.writeObject(dPFPSample.serialize());
This the code that i used on server socket
Socket clientSocket = new Socket("localhost", 5002);
ObjectInputStream ois ...
|
|
I'm working on a network app written in Java, using ObjectOutputStream and ObjectInputStream on top of Sockets to exchange messages. My code looks like this:
Sender:
ObjectOutputStream out;
ObjectInputStream in;
try{
...
|
I recently figured out how to use ObjectOutputStream and ObjectInputStream to send objects over a simple Java socket connection between a server and a client. I was wondering if I wanted ... |
Hello I am trying to send a Java File Object over a socket to a server which will then store it in a database. Currently I have created a FileBean which ... |
I am writing a byte array from a socket client as:
byte[] arr = { 49, 49, 49, 49, 49};
InetAddress address = InetAddress.getByName(host);
connection = new Socket(address, port);
out = new ObjectOutputStream(connection.getOutputStream());
out.flush();
At receiving end, ... |
I am lsitening on a server in my program and when cleint sends a message, I first send a 1-byte ACK back, where 1 byte is msgType that I received.
My program ... |
Is it more efficient to flush the OutputStream after each individual invocation of ObjectOutputStream#writeObject rather than flushing the stream after a sequence of object writes? (Example: write ... |
I'm trying to send an xml message to a server from a client app using sockets in Java but i don't know how to write it to the stream:
...
|
The Application
I'm writing a client/server application in Java, that communicates by sending objects over sockets using the ObjectStream classes. Each node in the application looks approximately like this:
class Node {
...
|
I have this to send string or integer but if i want to send a string array what should i use?
// A string ("Hello, World").
...
|
Im trying to send a custom-made object over a socket connection. The class implements serilizable but the constructor still throws a NotSerializableException when im trying to write the object to the ... |
I'm trying to implement basic communication through sockets, what I have now is:
|
Case:
We got a server and a client.
On the server side, we have:
Server (Socket bla bla bla)
IDocument - Interface for Documents
Message - Implements document
On the client side we have
Client - Socket ... |
I am trying to send files of a simple HTML picture gallery. I can send html files and thumbnails of pictures with no problem. But when I start sending pictures, while ... |
Hi all, I have created a Client/Server app that uses a socket. The Client is in Java but the backend server is in C++. If it was all in Java this would not be a problem but I do what I am told. Anyway the Java Client has a message it wants to send to the Server. The message is a ... |
|
Ok this leads me to another question, why do network programmers bother writing protocols to map objects to their byte representation? Can't all of it be skipped by making network stuff implement Serializable then relying writeObject() and readObject()? Also, can I use these two methods with NIO? All the NIO examples I've read use ByteBuffers. |
Thanks for answering! You were right, i was ignoring an exception on the client side: java.io.StreamCorruptedException: invalid type code: AC. I create one ObjectOutputStream for each socket from my socketlist each time i want to send and for listening doesnt the thread starts with an InputStream. As I Understand, my problem is that the InputStream has a connection only with one ... |
A couple of suggestions; - always create the OutputStream first and flush it before creating the input stream. The is because the ObjectInputStream reads some data when it is created. (And it will block until it gets it) - Never attach more than one reading or writing stream to a socket. You are creating two ObjectInputStreams, the first reads the valid ... |
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.plaf.basic.BasicMenuItemUI.getMenuItemParent(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.layoutMenuItem(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.paintMenuItem(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.paint(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.update(Unknown Source) at javax.swing.JComponent.paintComponent(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.BufferStrategyPaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent._paintImmediately(Unknown Source) at javax.swing.JComponent.paintImmediately(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown ... |
Hi there i managed to send a windows through network with the Object(Input/Output)Stream but i dont know if it is possible with this 2 classes to send the ActionListener-ActionPerformed within the Stream. For Ex If i send a Calculator could i make it work through Network by the network user clicking on numbers and add,sub..... Thanks |
|