Why my send and receive Object sometime is different? [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I trying to send an object by server to receiver or reverse.However, most of time it is true and done completely but sometimes when I send an object, the receiver get the object that I sent before it and object are sent by sender lost.I have used Socket in my project and read and write by ObjectInputStream and ObjectOutputStream.

If you're sending the same object with different values you need to call ObjectOutputStream.reset() before the second send if you want the receiver to get the changed object. Or call writeUnshared() instead of writeObject().

Related

Replying to a message in thread using a slash command [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
Can we use a slash command to send a message in thread(replying to some previous message) in a channel?
To post a threaded reply, you'll need original message's timestamp.
The payload generated by 'Slash Command' interactivity can't provide you that.
Instead you should use 'Message Shortcuts' for this implementation.
Then use chat.PostMessage and add original message's timestamp as thread_ts argument.

how to share a public key [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
My question is not about how to create a public key in java, but how do I send it to another client.
I have a server and two clients communicating with each other, when a client tries to send a message, the program encrypts it using the clients private key, then, it sends the encrypted byte array throw the stream with the other clients public key, this is my point, how do they know each other?
Is there a way to send the public key to a specific client?

Two Sockets for Only One Connection [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am making an instant messenger in Java and I want to add the ability to send images as well as text. The first thing that came to mind was to make new Sockets and input and output streams. Firstly, will this work and is it good practice. Secondly, if this doesn't work then how does the receiving end of the message figure out if what it is receiving is an image or a String?
An output stream contains bytes, which you have to build into messages. The reader knows which type of data you sent, because the sender will have to say which type of message it is sending.
e.g. if you write say "image" as a string you could assume that what follows it is an image.
Remember that you're not transmitting Strings or Images, you're exchanging Messages. A message should have a content or message type associated with it.

Ways to pass an ArrayList with socket [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
What is the best way to pass an ArrayList<Object> from server to client?
After i have to put my ArrayList in a JTable.
You have to serialize it when you write to the socket and deserialize when you read from the socket.
Ultimately you're sending Strings on the wire. Transport doesn't know or care anything about objects on either end of the conversation. TCP/IP is language independent.
You have many choices to choose from:
Java Serializable - this means sending byte code on the wire.
XML. You can use JAXB.
JSON. You can use Jackson.
Custom protocol of your own design.

How transmit parameters from href by not method GET? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How transmit parameters from href by not method GET?
I use spring. maybe spring tools can to help me?
by method get:
${candidate.name}
candidate.id transmit by get method
How transmit candidate.id by Post(for example method)?
No,By default href hits get method,There is no way to specify a method.
Try some html form to specify Method's or move your logic to GET.
If you can use client script (javascript),There is possibility do it with.

Categories

Resources