473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About Transfering Complex datastructures using Sockets

I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...

Jun 28 '06 #1
7 1432
sa****@gmail.com (in
11**********************@y41g2000cwy.googlegroups. com) said:

| I need the explanation/code to transmit a complex datastructure like
| Linked list or binary tree
| using sockets from client to sever...

Not terribly difficult - just decide how you plan to parse the list or
tree, what (symbolic?)representation makes sense for the pointers and
the specifics of your protocol for passing a single element. Once
that's done, all you need to do is write the code to implement what
you've specified.

If you have difficulties with the C coding part of the problem, look
for help here. :-)

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto
Jun 28 '06 #2
sa****@gmail.com wrote:
I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...


<Off-topic>
In the general case, transfer the elements individually and rebuild
the data structure in the receiving end.
(There may be shortcuts in some particular scenarios.)
Try posting again in comp.programming
</Off-topic>
Jun 28 '06 #3
sa****@gmail.com wrote:
I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...


Then write serialisers and deserialisers and read up on the socket
implementation for your platforms of interest. Alternatively, use a
language that has all this built in.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
Jun 28 '06 #4

sa****@gmail.com wrote:
I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...


Use sprintf() and store into a character array and transfer through
sockets.
Do the reverse in the receiving side.

That what i'm doing to avoid big-endian and little endian problems.

Jun 28 '06 #5

deepak wrote:
sa****@gmail.com wrote:
I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...


Use sprintf() and store into a character array and transfer through
sockets.
Do the reverse in the receiving side.

That what i'm doing to avoid big-endian and little endian problems.


what about if the two machines don't use your character encoding?

Hint: this is why things like ASN.1 were invented.

Tom

Jun 28 '06 #6
"deepak" <de*********@gmail.com> writes:
sa****@gmail.com wrote:
I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...


Use sprintf() and store into a character array and transfer through
sockets.
Do the reverse in the receiving side.

That what i'm doing to avoid big-endian and little endian problems.


Linked lists and binary trees include pointers. Pointers can be
converted to strings with sprintf, and back again with sscanf, but the
values will be meaningless on the receiving side. In the general
case, you'll need to map pointer values to some kind of index, then
allocate the individual nodes on the other end and re-map the indexes
back to pointers.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jun 28 '06 #7
sa****@gmail.com writes:
I need the explanation/code to transmit a complex datastructure like
Linked list or binary tree
using sockets from client to sever...


If you find a way to serialize and deserialize the information
contained in the nodes then you can use either XML or, easier to use,
LISP syntax to send the information along with the structure.

A
/ \
B C
/ \ / \
D E F G

The above structure can be sent as:

(A (B (D E)) (C (F G)))

You can run into problems if you have ( and ) as part of the
information in the nodes. If you escape those characters or if you
encode all the information in the nodes to use printable characters
except for '(' and ')' in a specific encoding you should be safe and
have an almost portable protocol.
Check uuencode and uudecode for hints.

--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
Jun 29 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1211
by: Bram Stolk | last post by:
Hello, Python features the Queue.Queue object that provides thread-safe access. What if I want thread access to other types of datastructures? Would I need to pair e.g. each list, Set or...
2
373
by: Mark G. Zeringue | last post by:
Which newgroup wouldbe best for questions about using sockets in dot net? Thanks Mark
7
1511
by: Ravi J | last post by:
What is the best way to transfer files between two .NET executables? I have a service, and a client program. Client asks service for data. The service creates one, and passes it back to client....
1
1732
by: Michael Shestero | last post by:
Hello. General description of my knotty problem: I have a code (a function f) on standart C++ that perform some smart action. This code works as console application getting user input from...
5
1331
by: Daniel Fudge | last post by:
I'm trying to call an executable and read an object from it. For sake of simplicity say it's just the double "x". In my Read_Object.exe code I can call the program with the following. i =...
0
2506
by: olafmol | last post by:
Hello, i have a problem using a .NET WSDL Webservice from PHP. Using both the NuSOAP lib for PHP4, and the build-in SOAP lib for PHP5 it seems that the SOAP client cannot pass a variable amount...
1
1029
by: Dzemo | last post by:
Is there any way to transfer picture files between two computers on LAN. Do I need to use sockets or... Any ideas or examples THX
5
2268
by: Pilence | last post by:
Hy!! Can someone tell me please how to do this type of work done by using C#......
2
1223
by: mohi | last post by:
hello every one , i know this is a c++ forum ,but as i cudn't get any datastructures forum ..iam posting here : can anyone tell me which is the best language to be used for implementation of...
0
7231
marktang
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,...
1
7066
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...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5643
agi2029
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,...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.