You are not logged in.

Tom

Trainee

  • "Tom" is male
  • "Tom" started this thread

Posts: 48

Location: Darmstadt, Germany

  • Send private message

1

Monday, September 6th 2004, 12:26pm

Send objects via QSocket

Hi there,

currently, I do send objects via QSocket by cutting them down and send each attribute. The receiver takes all incoming attributes and creates an object.
But sometimes writeBlock() sends more than an object, three or more in one package,
How can I force it to send when I want to?

Is there another possibility of sending objects?

Many thanks in advance.

Ciao
Tom
---
There are only 10 types of people in the world:
Those who understand binary and those who don't.
---

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

2

Monday, September 6th 2004, 12:31pm

You can flush the socket, but I think you better design your protocol to allow merged blocks.

For example sending some kind of start and end marker.

Cheers,
_
Qt/KDE Developer
Debian User

Tom

Trainee

  • "Tom" is male
  • "Tom" started this thread

Posts: 48

Location: Darmstadt, Germany

  • Send private message

3

Monday, September 6th 2004, 12:46pm

Hi anda_skoa,

I'll try it with struct.
Think it's gonna work.

Ciao
Tom
---
There are only 10 types of people in the world:
Those who understand binary and those who don't.
---

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

4

Monday, September 6th 2004, 2:28pm

Just in case you mean writing a struct as one block of memory I would advise against it.

This is really unportable, better use QDataStream to write each field.

Cheers,
_
Qt/KDE Developer
Debian User