| |

VerySource

 Forgot password?
 Register
Search
View: 887|Reply: 7

socket problem

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-5 07:00:01
| Show all posts |Read mode
Can socket send objects such as ArrayList
how to do?

Thank you
Reply

Use magic Report

1

Threads

26

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-3-25 14:45:01
| Show all posts
Serialized into a byte array can be sent!
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-3-27 19:15:01
| Show all posts
Can you give an example?
Thank you
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-30 16:30:01
| Show all posts
It really doesn't work, add ArrayList delimiter to generate a string to send, and the receiver will split it
Reply

Use magic Report

0

Threads

27

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-4-5 11:00:01
| Show all posts
The socket sends a byte stream. If you want to send an object, you can use remoting to do it.
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-6 14:45:01
| Show all posts
After serializing to stream, the sequenced byte array is obtained, and the receiving end is deserialized. Serialization:
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new BinaryFormatter ();
ArrayList lst = new ArrayList ();
lst.Add ("123");
MemoryStream stream = new MemoryStream ();
bf.Serialize (stream, lst);
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Unknown

Post time: 2020-4-11 23:15:02
| Show all posts
Send line by line until the end
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-2 12:45:01
| Show all posts
Serialization is rewarding.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list