在客户端服务器中发送结构 [英] sending structure in client server..

查看:94
本文介绍了在客户端服务器中发送结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想发送一个结构(用户定义),例如:


struct bank {


int empid;

char name [50];

浮动金额;


} per;


我想把它从客户端发送到unix上的服务器。任何人告诉我

如何发送(从客户端)并读取另一端的数据(在

服务器).tnx提前...

解决方案

10月11日晚上7:18,swetha< ;笔记本电脑... @ gmail.comwrote:




我想发送一个结构(用户定义),例如:< br $> b $ b结构银行{


int empid;

char name [50];

浮动金额;


}每个;


我想将这个从客户端发送到unix上的服务器。任何人都告诉我

如何发送(从客户端)并在另一端读取数据(在

服务器上).tnx提前...


在适当的新闻组中提问。 < comp.unix.programmermight help

you。

unix,networking et cetera在< comp.lang.cwhere
$ b中偏离主题$ b仅讨论C语言。


2008年10月11日16:18,swetha写道:


我想把这个从客户端发送到unix上的服务器。任何人告诉我

如何发送(从客户端)并在另一端读取数据(在

服务器).tnx提前...



假设客户端和服务器都运行在同一台机器上,

那里有多种选择可供选择,如果没有关于你的设置的更多信息,很难推荐

特别的。例如,您可以使用命名管道,共享内存或

套接字。如果客户端和服务器在不同的机器上运行,

你需要依赖最后一个选项......


要查找更多,进程间通信。或IPC或IPC。对谷歌而言,这将是一个很好的

术语。如果你想在这里获得更多指导,你需要更详细地描述你的应用程序。


我想要发送一个结构(用户定义),例如:


您需要担心该结构是否会在客户端和服务器上表示为相同的
。不同的架构使用

int和float的不同大小,可以使用不同的endianness,

并使用不同的填充。即使是相同的架构运行

不同版本的编译器也可能存在这些问题。如果客户端和服务器可能不同,那就是
a问题。


如果结构是在文件中发送的,你会遇到同样的问题

从一台机器复制到另一台机器,或通过网络复制。


> struct bank {

int empid;
char name [50];
浮动数量;

} per;

我想在unix上将它从客户端发送到服务器。可以告诉我
如何发送(从客户端)并在另一端(在
服务器上)读取数据.tnx提前...



Hi ,
I want to send a structure (user defined) for example :

struct bank{

int empid;
char name[50];
float amount;

} per;

I want to send this from a client to server on unix.Can any1 tell me
how to send this(from client) and read the data at the other end(at
server).tnx in advance...

解决方案

On Oct 11, 7:18 pm, swetha <laptop...@gmail.comwrote:

Hi ,
I want to send a structure (user defined) for example :

struct bank{

int empid;
char name[50];
float amount;

} per;

I want to send this from a client to server on unix.Can any1 tell me
how to send this(from client) and read the data at the other end(at
server).tnx in advance...


Ask in an appropriate newsgroup. <comp.unix.programmermight help
you.
Unix, networking et cetera are off-topic here in <comp.lang.cwhere
only the C language is discussed.


On 11 Oct 2008 at 16:18, swetha wrote:

I want to send this from a client to server on unix.Can any1 tell me
how to send this(from client) and read the data at the other end(at
server).tnx in advance...

Assuming the client and server are both running on the same machine,
there are a wide variety of options available to you, and without
further information about your setup, it''s hard to recommend one in
particular. For example, you could use named pipes, shared memory or
sockets. If the client and server are running on different machines,
you''ll need to rely on the last of those options...

To find out more, "interprocess communication" or "IPC" would be a good
term to Google. If you want more guidance here, you''ll need to describe
your application in more detail.


I want to send a structure (user defined) for example :

You need to worry about whether that structure will be represented
the same on the client and the server. Different architectures use
different sizes for int and float, may use different endianness,
and use different padding. Even the same architecture running
different versions of the compiler might have these issues. It''s
a problem if the client and server could be different.

You''ll have the same issues whether the structure is sent in a file
copied from one machine to another, or over a network.

>struct bank{

int empid;
char name[50];
float amount;

} per;

I want to send this from a client to server on unix.Can any1 tell me
how to send this(from client) and read the data at the other end(at
server).tnx in advance...



这篇关于在客户端服务器中发送结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆