473,320 Members | 1,916 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,320 software developers and data experts.

buffer or que implementation

I need to write tcp client/server program.
The client should connect to server at specified intervals and download some
data.
The data is collection of strings.
What I don't know how to do is how to implement some kind of queue, so this
string as queued at server, then client connects, get them, clear them from
queue and process them. The client should interpret these string as separate
objects, not as an whole.
Forget the string part. The data can be of any type. I need an idea how to
implement queuing method.

TIA
Nov 21 '05 #1
6 1032
"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
I need to write tcp client/server program.
The client should connect to server at specified intervals and download
some data. The data is collection of strings.
What I don't know how to do is how to implement some kind of queue,
so this string as queued at server, then client connects, get them, clear
them from queue and process them. The client should interpret these
string as separate objects, not as an whole.


The simplest way you could do this would be to hold the "queue" as a
text file on the server (this way, it doesn't matter how long the queue
builds up for - what can you do if you rely on the server holding the
queue in memory and the server process crashes?). This file can use
whatever delimiters you might need to identify the structure(s) it contains.

The Client process connects to a socket on the server.
The Server process (probably in a separate thread) reads the entire
queue file, writes it back to the Client's socket, then throws the file
away.
The Client can then interpret the data anyway it needs to.

HTH,
Phill W.
Nov 21 '05 #2
You may also want to look into the Message Queueing service on the
server. Your client can connect to the message queue and retrieve the
object from the queue.

chris

Nov 21 '05 #3
I am not sure that i can connect to Message Queuing service form client.
It's is going to be an Internet application.
"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
You may also want to look into the Message Queueing service on the
server. Your client can connect to the message queue and retrieve the
object from the queue.

chris

Nov 21 '05 #4
In my case I don't care if server craches.

"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message
news:cs**********@yarrow.open.ac.uk...
"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
I need to write tcp client/server program.
The client should connect to server at specified intervals and download
some data. The data is collection of strings.
What I don't know how to do is how to implement some kind of queue,
so this string as queued at server, then client connects, get them, clear
them from queue and process them. The client should interpret these
string as separate objects, not as an whole.


The simplest way you could do this would be to hold the "queue" as a
text file on the server (this way, it doesn't matter how long the queue
builds up for - what can you do if you rely on the server holding the
queue in memory and the server process crashes?). This file can use
whatever delimiters you might need to identify the structure(s) it
contains.

The Client process connects to a socket on the server.
The Server process (probably in a separate thread) reads the entire
queue file, writes it back to the Client's socket, then throws the file
away.
The Client can then interpret the data anyway it needs to.

HTH,
Phill W.

Nov 21 '05 #5
Are there multiple clients that will connect and do each of them need their
own queue state?

I would create a web service to do this. Pass in the Client ID and the last
time they connected. Save the queue in a database with an incrementing
counter. Client connects, gets all data after the last time he connected.

Does this help?
Chris

"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
I need to write tcp client/server program.
The client should connect to server at specified intervals and download
some data.
The data is collection of strings.
What I don't know how to do is how to implement some kind of queue, so
this string as queued at server, then client connects, get them, clear
them from queue and process them. The client should interpret these string
as separate objects, not as an whole.
Forget the string part. The data can be of any type. I need an idea how to
implement queuing method.

TIA

Nov 21 '05 #6
Using database or file to store is too much of over head. I just need in
memory queue. For now the client is one. If there are more, there are going
to be different queues for every client.
What I mainly can't figure out if i store the date in array or something,
what happens when cleint start reading data and in the same moment a new
piece of data is added. There must be some way to queue things in .NET.

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:%2****************@TK2MSFTNGP14.phx.gbl...
Are there multiple clients that will connect and do each of them need
their own queue state?

I would create a web service to do this. Pass in the Client ID and the
last time they connected. Save the queue in a database with an
incrementing counter. Client connects, gets all data after the last time
he connected.

Does this help?
Chris

"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
I need to write tcp client/server program.
The client should connect to server at specified intervals and download
some data.
The data is collection of strings.
What I don't know how to do is how to implement some kind of queue, so
this string as queued at server, then client connects, get them, clear
them from queue and process them. The client should interpret these
string as separate objects, not as an whole.
Forget the string part. The data can be of any type. I need an idea how
to implement queuing method.

TIA


Nov 21 '05 #7

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

Similar topics

6
by: manders2k | last post by:
Hi all -- I'm contemplating the idea of writing a simple emacs-like editor in python (for fun and the experience of doing so). In reading through Craig Finseth's "The Craft of Text Editing": ...
8
by: Tron Thomas | last post by:
As part of applying for a programming position at a company, I recently I had submitted some code samples to one of the developers for review. This is the feedback I received: One of his...
1
by: inkapyrite | last post by:
Hi all. I'm using ifstream to read from a named pipe but i've encountered an annoying problem. For some reason, the program blocks on reading an ifstream's internal buffer that's only half-filled....
4
by: ma740988 | last post by:
A few days ago I recieved yet again advice on implementing a buffer of bytes. At issue: (part 1) how do I take the contents of a struct, then dump (used sparingly) it into a byte buffer. ...
5
by: Sandy | last post by:
Hi, In one of my interview i was asked the difference between Stream and Buffer. can anybody explain the difference. Thanks
11
by: Ben Collingsworth | last post by:
Anyone have some efficient source code for implementing a ring buffer?
5
by: Roy Hills | last post by:
When I'm reading from or writing to a network socket, I want to use a struct to represent the structured data, but must use an unsigned char buffer for the call to sendto() or recvfrom(). I have...
2
by: William Stacey | last post by:
Working with implementing a circular buffer for a producer/consumer deal. Have not done one in a while. The following seems to work. However, I remember and have seen other implementation that...
7
by: toton | last post by:
Hi, I want a circular buffer or queue like container (queue with array implementation). Moreover I want random access over the elements. And addition at tail and remove from head need to be low...
16
by: junky_fellow | last post by:
Is there any efficcient way of removing the newline character from the buffer read by fgets() ? Is there any library function that is similar to fgets() but also tells how many bytes it read...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.