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?
Related
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.
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.
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.
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
Can I send mail to multiple hosts like Gmail,Hotmail and so on using JavaMail API
In other words Can I send array of InternetAddress "TOList" or "CcList" where this array contain different hosts ? Thanks in advance .
You can call addRecipient multiple times it to add recipients to your email. For example:
msg.addRecipient(Message.RecipientType.TO, InternetAddress.parse("user1#server1.com"));
msg.addRecipient(Message.RecipientType.CC, InternetAddress.parse("user2#server2.com"));
msg.addRecipient(Message.RecipientType.BCC, InternetAddress.parse("user3#server3.com"));
To send an array, you can do the following:
Address[] ccRecipients = new Address[] {InternetAddress.parse("user1#server1.com"),
InternetAddress.parse("user2#server2.com")};
msg.addRecipients(Message.RecipientType.CC, ccRecipients);
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().