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... 10 2589
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...
Antoninus Twink <no****@nospam.invalidwrites:
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...
[...]
>
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.
If you want more guidance here, you'll be asking in the wrong place.
comp.unix.programmer is full of Unix experts, most of whom know more
about this stuff than most of the people here. "Antoninus Twink", for
whatever reason, apparently doesn't want you to know that.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
"swetha" <la*******@gmail.comwrote in message news:
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...
write two functions
int serialise_bank(const struct bank *b, void *buff)
void deserialise_bank(struct bank *b, void *buff)
They turn the structure into a platform-independent packet of bytes. You can
use sprintf(buffer, "%.*f", FLT_DIG, b->amount) to serialise the float in
ascii, or you can break it up into sign, exponent and matissa and send it in
binary.
Similarly the integers need to be in big or little endian. Preferably
big-endian in case those little endians take over the world and make us all
store our ints at the little end.
Then just send the packet over the network
--
Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm
On Oct 11, 6:15*pm, Antoninus Twink <nos...@nospam.invalidwrote:
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,
isn't that a rather atypical Client Server application?
Yes, I know it happens but wouldn't it be more reasonable
to assume the Client and Server were on different machines.
Maybe utterly different hardware.
To the OP: try a Unix newsgroup and ask about sockets.
<snip>
--
Nick Keighley
On 12 Oct 2008 at 19:58, Nick Keighley wrote:
On Oct 11, 6:15Â*pm, Antoninus Twink <nos...@nospam.invalidwrote:
>Assuming the client and server are both running on the same machine,
isn't that a rather atypical Client Server application?
Yes, I know it happens but wouldn't it be more reasonable
to assume the Client and Server were on different machines.
I'd hardly call it atypical. How many daemons are running on your
machine at the moment waiting for local connections? Are you running X
Windows at the moment with local client programs?
The OP didn't give us enough information to tell what his setup was: I
gave advice (which you snipped) that deals with both situations.
Nick Keighley wrote:
>
To the OP: try a Unix newsgroup and ask about sockets.
He did, yesterday.
--
Ian Collins
Antoninus Twink wrote:
On 12 Oct 2008 at 19:58, Nick Keighley wrote:
>On Oct 11, 6:15 pm, Antoninus Twink <nos...@nospam.invalidwrote:
>>Assuming the client and server are both running on the same machine,
isn't that a rather atypical Client Server application? Yes, I know it happens but wouldn't it be more reasonable to assume the Client and Server were on different machines.
I'd hardly call it atypical. How many daemons are running on your
machine at the moment waiting for local connections? Are you running X
Windows at the moment with local client programs?
Plenty and they also accept and correctly process remote ones. Fool.
--
Ian Collins
On Sat, 11 Oct 2008 20:42:04 +0100, Malcolm McLean wrote:
"swetha" <la*******@gmail.comwrote in message news:
>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...
write two functions
int serialise_bank(const struct bank *b, void *buff)
void deserialise_bank(struct bank *b, void *buff)
They turn the structure into a platform-independent packet of bytes. You
can use sprintf(buffer, "%.*f", FLT_DIG, b->amount) to serialise the
float in ascii, or you can break it up into sign, exponent and matissa
and send it in binary.
Similarly the integers need to be in big or little endian. Preferably
big-endian in case those little endians take over the world and make us
all store our ints at the little end.
Or just use XDR and don't reinvent the weel :)
>
Then just send the packet over the network
--
Pietro Cerutti This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Offer |
last post by:
Hi, I create a TCP connection between client & server and I need to
send vectors via ObjectInputStreams back and forth (the client
initiates the protocol).
The connection is established...
|
by: WIWA |
last post by:
Hi,
I want to make a UDP client server application that is conform to
RFC868 (Time protocol). Both the UDP client and UDP server are in a
test phase.
The question is: when I add ...
|
by: Christian Westerlund |
last post by:
Hi!
Does anyone know if it is possible for a client server communication
easy in .NET with these requirements:
The client always initiates the communication
The server only answers (responds)...
|
by: Webster |
last post by:
Hello,
What's the best way to run a client-server interaction using some
standardized protocol such as nntp?? That is, should you run a thread that
just does a receive loop from the server so...
|
by: Yossarian |
last post by:
I have a handheld running CE .NET 4.2 and I am using c# with framework
1.1 to develop a solution for syncing data that is on the handheld with
the local pc.
Our handheld cradles only support...
|
by: danishce |
last post by:
Hello All:
I am developing a client/server application using vb.net winsock programming.
I am sending data to Server and at the same time receive the incoming data from the server.
My application...
|
by: Cichy |
last post by:
Hello,
I'm writing a Client-Server application using sockets (asynchronous).
There is a Server (Master) which accepts incoming connections, and
Client (Slave).
Afetr establishing connections...
|
by: nsaffary |
last post by:
hi
I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set...
|
by: Babloo |
last post by:
Hi everyone,
i wanted to implement a client- server connection
and transfer a file over the network. i was able to implement a normal
set up where in i was able to send chat messages and small...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |