WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #14  
Old 04-28-2005, 10:26 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I did some tests here and got it working. Here is the C++ code I used to generate the packet:
Code:
std::string packString(const char *message)
{
	std::string pack = message;
	int stringLen = ceil( (pack.size() + 1) / 4.0 ) * 4;
	for(int i = pack.size(); i < stringLen; i++)

		pack += '\0';
	return pack;
}

std::string createPacket(const char *message)
{
	return packString("master") + packString(",s") + packString(message);
}
The createPacket function uses the packString function to generate 3 string packets. The first string packet is the address of the computer you are sending from. You can set this to whatever you want. The second string packet is the type of the data. If you will only be sending one string then you don't need to change this. The last string packet is the message you want to send. The packString function simply pads the string with some NULL characters. After this, simply send the string returned by createPacket over the socket. Let me know if you can't get this working.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:48 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC