LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2007, 08:17 AM   #1
soumya_b
LQ Newbie
 
Registered: Jan 2007
Posts: 4

Rep: Reputation: 0
problem in sending array of structures in client/server program


i am writing a client server program wherein i have to send multiple records containing many fields. when i send from client to server only 1st record is being print not the second. wat can i do in this case?
 
Old 01-18-2007, 08:26 AM   #2
KenJennings
LQ Newbie
 
Registered: Mar 2005
Location: FL, USA
Distribution: SuSE
Posts: 28

Rep: Reputation: 15
How are you sending the records? Describe how you're writing the data to the socket connection.
 
Old 01-18-2007, 09:10 AM   #3
MOS JEFF-INITELY
Member
 
Registered: Sep 2006
Distribution: Windows .. MUAHAHAHA
Posts: 66

Rep: Reputation: 15
send them as a struct.. im assuming your using C
 
Old 01-20-2007, 01:25 AM   #4
soumya_b
LQ Newbie
 
Registered: Jan 2007
Posts: 4

Original Poster
Rep: Reputation: 0
i am sending records in a structure.... there r fields defined in the structure... one structure is being sent but not the second and the rest...
 
Old 01-20-2007, 08:14 AM   #5
KenJennings
LQ Newbie
 
Registered: Mar 2005
Location: FL, USA
Distribution: SuSE
Posts: 28

Rep: Reputation: 15
You're doing a direct write/send of the memory block of the structure? That is bad form for network communications. This is not portable and only works when the client/sender and server/receiver are running on identical architectures.

For better portability between systems a simple thing to do is marshal all your structure elements into a text string. Delimiters between fields help with parsing, and some kind of start/end sentinel values will help the code know when it has received a complete string.
 
Old 01-21-2007, 03:53 AM   #6
varun_shrivastava
Member
 
Registered: Jun 2006
Distribution: Ubuntu 7.04 Feisty
Posts: 79

Rep: Reputation: 15
r u using IPC or socket programming
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending integer from server to client Diabolic_Soul Programming 2 12-27-2006 06:16 PM
Problem - A simple C program using Structures manishsingh4u Programming 6 05-15-2006 03:55 AM
Sending message from server to client paulwong Linux - Networking 6 07-22-2005 09:55 AM
sending Objects from Server to Client djgerbavore Programming 0 10-04-2004 12:09 PM
array of structures scanf entry question ... purpleburple Programming 21 10-01-2002 11:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration