java - How do I send an int array to server (throug socket) as an OutputStream? -


i have array storing few int numbers. want pass array server side server can calculate sum of numbers inside array , send results client. how that?

public static void main(string args[]) {      int[] num = new int[]{0,1,2,3};      if(msg.equalsignorecase("num")){ // msg user input         // send array server            }  } 

to send via network, need serialize somehow. simple case this, can manually (by converting comma separated list, example)

a better approach use well-known data-interchange format, such json. can find many examples online on how serialize json , de-serialize using popular libraries gson , jackson.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -