Re: Sending point cloud to another PC with socket send function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Sending point cloud to another PC with socket send function

You must first serialize the point cloud.  This can be accomplished by writing it to a file, then reading the contents of the file as a contiguous block of raw data.  However, I recently added a method to serialize point clouds in-memory.

You can find a rough example in the LZFInMem test case, in test_io.cpp:

In that test case, the variable pcd_str holds the serialized representation of the point cloud.  To get a pointer for the second parameter of send(), you'd call  The 3rd parameter would be pcd_str.size().

The rest of the test case shows how you'd deserialize it, on the other end.

Note that the in-memory serialization/deserialization functionality was added after the 1.8.1 release.  So, you must either use a more recent snapshot of PCL, or wait until the next release.


-----Original Message-----
From: PCL-users [mailto:[hidden email]] On Behalf Of Max
Sent: Tuesday, October 17, 2017 23:56
To: [hidden email]
Subject: [PCL-users] Sending point cloud to another PC with socket send function

Hi, everyone
I want to sent point cloud to another PC with socket. However, I have no idea about the second variable of send function. Here are some variables about the point cloud and send function:

typedef pcl::PointXYZRGBA PointT;
pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>);

send function:
    _In_ SOCKET s,
    _In_reads_bytes_(len) const char FAR * buf,
    _In_ int len,
    _In_ int flags

Can anyone help me to fix the send function as the following:
send(Socket, &cloud, sizeof(cloud), NULL);

P.S. In fact, maybe I have no idea about how to fill in the "?" about this:
       send(Socket, ?, ?, NULL);

Any help is appreciated.

Thank you very much!

Sent from:
[hidden email] /


This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.
[hidden email] /