473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

How do I know that data written to a shared memory segment in Unix is stored properly

Hello all,

I am trying to write a client/server application that takes input to an array of structures from the user,stores the data in a shared memory segment and then writes the same to a file when I close the application. How do I get started? And how do I ensure that the server stores the data correctly? Also, the server needs to be a concurrent server that accepts connections from multiple clients.
Mar 8 '12 #1
1 1694
johny10151981
1,059 1GB
Question: why do you need to shut down server?

anyway,
1. Use TCP not UDP
2. When you accept an Connection Request open it with new Thread
3. When you write data to file it returns the number of bytes, you can verify it. You can also verify the written data, but its pointless
4. When you use shared memory make sure to lock the memory segment so that other thread cannot use this.
5. You can save your data before application close normally. You can also use signal to detect close request from somewhere other then application itself, look at the link, also read this link, it has example to show how to handle signal
Mar 12 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: S Green | last post by:
Does any one now if a shared memory module exists, written in python for a windows platform. I now one exists for unix? help most appreciated, S Green
0
by: Ron Ben-Natan | last post by:
Hi, Local clients talking to the server do so over the shared memory net-library. As far as I understand they use a shared memory segment and an event to signal each other when data is ready....
3
by: alanrn | last post by:
I would like to start a dialog on how to implement the equivalent functionality of UNIX shared memory in .NET. I work with a factory automation system. The bulk of the system is written in C/C++....
18
by: John DeSoi | last post by:
I get this when I try to start up a freshly compiled beta4 on OS X 10.2.6: FATAL: could not create shared memory segment: Invalid argument I saw a previous thread on this for beta2. It...
5
by: Jim | last post by:
Hello, I have a broken server that we are going to be moving off to a new server with a new version of DB2 but here is what I have right now: RedHat 7.0 (2.2.24smp) DB2 v6.1.0.40 I am...
1
by: Alexander Cohen | last post by:
Hi, sometimes ill get this error: FATAL: could not create shared memory segment: Cannot allocate memory DETAIL: Failed system call was shmget(key=2, size=4153344, 03600). HINT: This error...
1
by: nass | last post by:
hello everyone.. i am not sure what is wrong - never liked strings anyway! my problem is that i am trying to save a QCstring in a shared memory segment and i get a segmentation fault.. here is...
1
by: zeny | last post by:
Hey everyone! I´ve been tying to create a shared memory segment with the size of a structure, as follows: typedef struct{ int id; char message; }data; In the line where i create the shared...
5
by: Sune | last post by:
Hi all, I want to make data stored in-memory (not disk) available to several processes. My concern is that poorly written C applications with dangling pointers may(will) damage the data in this...
2
by: oopsatwork | last post by:
Ok...so, I have been outside of the C world for a _very_ long time...but not so long as to remember how to do multidimensional arrays. So, let me state that I know how to malloc pointers to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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
isladogs
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...

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.