#include <iostream>
#include <cstdlib>
#include <string>
#include "SysPlusPlus"
#include "ComPlusPlus"
 
int main (int argc, char *argv [] ) {

if ( argc != 2 ) {
  std::cout << "Usage " << argv[0] << " [port]\n";
  return 1;
} 
int port =  std::atoi(argv [1]);
	
try {
 compp::SocketUdp Client;	
 // -> Comment 1
 Client.Connect("127.0.0.255", port ) ; 
 // -> Comment 2
 Client.SetSockOptBroadcast(true);
 // -> Comment 3
 Client.Write( "Writing to the World!");
 // -> Comment 4
 std::string s = "Broadcasting with Sendto!\n";
 Client.Sendto(s.c_str(), s.length(), "127.0.0.255", port);
 Client.Close(); 
} catch ( syspp::ComException e ) {
	std::cout <<  "Exception " << e.what() << "\n" ;	
}
 return 0;	
}
