How to send and receive an array of character pointers char *argv from server to client in linux socket programming

I have a char * array like

 char *options[n] ; // n = 2 just for example . 

 options[0] = "How to";

 options[1] = "Send";

How do I send "options" from server to client , using just one function call like send. Since the prototype of send is like this int send(int sockfd, const void *msg, int len, int flags); and receive is int recv(int sockfd, void *buf, int len, int flags); I am not sure how to cast "options" such that send and receive can take place in one function call.

Answers


You have to send the actual character strings. The pointers are memory addresses on you machine and are only accesable/meanaingful inside your program.

Even if the client and server were on the same machine the OS would block any attempt to access the client programs memory.


Need Your Help

Clicking on MenuItem without clicking on the text

java jsf richfaces seam

I've got a Menu, and I want to click on the menu, but not on the text if you guys know what i mean.

Responsive sizes for a desktop version?

css responsive-design media-queries

I'm setting up the initial basics of a responsive site. I've specified the mobile and tablet sizes but not sure what to do with the desktop version:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.