🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Aitor Matilla Tue, 25 Sep 2007 07:43
Data through Socket Connection
#826
Author: Aitor Matilla
Date: Tue, 25 Sep 2007 07:43
10 lines
1320 bytes
Hello,
I'm trying to connect two applications in different computers through a 
client-server socket connection. I'm interesting to send a big amount of 
data and I don't know how to do it.

First of all, I thought to use SendBuf / ReceiveBuf (i.e : SendBuf (Buf, 
sizeof(myclass))). However, it shouldn't work because of I cannot send 
memory addresses?

Any idea ? .Aitor
Re: Data through Socket Connection
#827
Author: Remy Lebeau (TeamB)
Date: Tue, 25 Sep 2007 16:36
26 lines
1907 bytes
"Aitor Matilla" <matilla@sensofar.com> wrote in message
news:46f8bc4e$2@newsgroups.borland.com...

> I'm trying to connect two applications in different computers
> through a client-server socket connection. I'm interesting to
> send a big amount of data and I don't know how to do it.

I suggest you read up on socket programming in general.  There are plenty of
books and tutorials available.  And go to http://www.deja.com to search the
newsgroup archives for code examples.

> First of all, I thought to use SendBuf / ReceiveBuf (i.e : SendBuf
> (Buf, sizeof(myclass))).

That is exactly what you do.  There is more to it than just that, though -
error handling, handling of partial data blocks, blocking vs. non-blocking,
etc.

> However, it shouldn't work because of I cannot send memory addresses?

You don't send the addresses themselves.  That is not how sockets work.  The
data being pointed to is what gets sents instead.


Gambit
Re: Data through Socket Connection
#831
Author: Bob Gonder
Date: Tue, 25 Sep 2007 22:28
15 lines
1659 bytes
Remy Lebeau (TeamB) wrote:
>"Aitor Matilla"  wrote
>
>> (Buf, sizeof(myclass))).
>> However, it shouldn't work because of I cannot send memory addresses?
>
>You don't send the addresses themselves.  That is not how sockets work.  The
>data being pointed to is what gets sents instead.

I think he was complaining that he wanted to send a class object, but
that object contains pointers, which doesn't work out so well.

Other than manually sending the individual pieces, is there some
"automatic" method/way to send all class members?
Perhaps some sort of  socket << complexobject ?
Re: Data through Socket Connection
#832
Author: Remy Lebeau (TeamB)
Date: Tue, 25 Sep 2007 22:55
17 lines
1395 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:2d2jf3dcnjtnkoja5c1a8tmfmc2uqj4e1n@4ax.com...

> Other than manually sending the individual pieces, is there
> some "automatic" method/way to send all class members?

No.  If the data is not a POD type, or a struct of POD types, then they have
to be sent individually.

> socket << complexobject ?

To do that, the user would have to provide a manual implementation of such a
'<<' operator.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads