diff options
Diffstat (limited to 'docs/tutorials/Chap_2')
-rw-r--r-- | docs/tutorials/Chap_2/Chap_2.zip | bin | 6712 -> 0 bytes | |||
-rw-r--r-- | docs/tutorials/Chap_2/ex01.html | 106 | ||||
-rw-r--r-- | docs/tutorials/Chap_2/ex02.html | 95 | ||||
-rw-r--r-- | docs/tutorials/Chap_2/ex03.html | 81 | ||||
-rw-r--r-- | docs/tutorials/Chap_2/ex04.html | 87 | ||||
-rw-r--r-- | docs/tutorials/Chap_2/ex05.htm | 87 | ||||
-rw-r--r-- | docs/tutorials/Chap_2/ex05.html | 87 | ||||
-rw-r--r-- | docs/tutorials/Chap_2/ex06.html | 76 |
8 files changed, 0 insertions, 619 deletions
diff --git a/docs/tutorials/Chap_2/Chap_2.zip b/docs/tutorials/Chap_2/Chap_2.zip Binary files differdeleted file mode 100644 index e9201ef1925..00000000000 --- a/docs/tutorials/Chap_2/Chap_2.zip +++ /dev/null diff --git a/docs/tutorials/Chap_2/ex01.html b/docs/tutorials/Chap_2/ex01.html deleted file mode 100644 index 0de2788c3cf..00000000000 --- a/docs/tutorials/Chap_2/ex01.html +++ /dev/null @@ -1,106 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess Communication -Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#FF0000">//Example 1</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Acceptor.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Stream.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_DATA -18</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_BUF -1024</FONT> - -<P>class Server{ - -<P>public: -<BR>Server (int port): -<BR> server_addr_(port),peer_acceptor_(server_addr_){ -<BR> data_buf_= new char[SIZE_BUF]; -<BR> } - -<P><FONT COLOR="#FF0000">//Handle the connection once it has been established.</FONT> -<BR><FONT COLOR="#FF0000">//Here the connection is handled by reading SIZE_DATA -amount of data</FONT> -<BR><FONT COLOR="#FF0000">//from the remote and then closing the connection</FONT> -<BR><FONT COLOR="#FF0000">//stream down.</FONT> -<BR>int handle_connection(){ -<BR> <FONT COLOR="#FF0000"> // Read data from client</FONT> -<BR> if(new_stream_.recv_n (data_buf_, SIZE_DATA, 0)==-1) -<BR> ACE_ERROR ((LM_ERROR, "%p\n", "Error in recv")); -<BR> - -<P> ACE_DEBUG((LM_DEBUG,"Server recieved %s \n",data_buf_)); -<BR> -<BR> <FONT COLOR="#FF0000">// Close new endpoint</FONT> -<BR> if (new_stream_.close () == -1) -<BR> ACE_ERROR ((LM_ERROR, "%p\n", "close")); -<BR> return 0; -<BR>} -<BR><FONT COLOR="#FF0000">//Use the acceptor component peer_acceptor_ to -accept the connection</FONT> -<BR><FONT COLOR="#FF0000">//into the underlying stream new_stream_. After -the connection has been</FONT> -<BR><FONT COLOR="#FF0000">//established call the handle_connenction() method.</FONT> -<BR>int accept_connections (){ -<BR> if (peer_acceptor_.get_local_addr (server_addr_) == -1) -<BR> ACE_ERROR_RETURN ((LM_ERROR,"%p\n","Error in get_local_addr"),1); - -<P> ACE_DEBUG ((LM_DEBUG,"Starting server at port %d\n", -<BR> server_addr_.get_port_number ())); -<BR> - -<P> <FONT COLOR="#FF0000">// Performs the iterative server activities.</FONT> -<BR> while(1){ -<BR> ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); -<BR> if (peer_acceptor_.accept -<BR> (new_stream_, &client_addr_, &timeout)== --1){ -<BR> ACE_ERROR ((LM_ERROR, "%p\n", "accept")); -<BR> continue; -<BR> } -<BR> else -<BR> ACE_DEBUG((LM_DEBUG, -<BR> "Connection established with remote %s:%d\n", -<BR> client_addr_.get_host_name(),client_addr_.get_port_number())); -<BR> <FONT COLOR="#FF0000">//Handle the connection</FONT> -<BR> handle_connection(); -<BR> } -<BR> } -<BR> -<BR> - -<P>private: -<BR> char *data_buf_; -<BR> ACE_INET_Addr server_addr_; -<BR> ACE_INET_Addr client_addr_; -<BR> ACE_SOCK_Acceptor peer_acceptor_; -<BR> ACE_SOCK_Stream new_stream_; -<BR> ACE_HANDLE newhandle; -<BR>}; - -<P>int main (int argc, char *argv[]){ -<BR> if(argc<2){ -<BR> ACE_ERROR((LM_ERROR,"Usage egX <port_num>")); -<BR> ACE_OS::exit(1); -<BR> } -<BR> Server server(ACE_OS::atoi(argv[1])); -<BR> server.accept_connections(); -<BR>} - -<P> <A HREF="ex02.html">Next Example</A> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_2/ex02.html b/docs/tutorials/Chap_2/ex02.html deleted file mode 100644 index 69891f26f1e..00000000000 --- a/docs/tutorials/Chap_2/ex02.html +++ /dev/null @@ -1,95 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 2</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess -Communication Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT><FONT COLOR="#FF0000"></FONT> - -<P><FONT COLOR="#FF0000">//</FONT><FONT COLOR="#CC0000">Example 2</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Connector.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/INET_Addr.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_BUF -128</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">NO_ITERATIONS -5</FONT> - -<P>class Client{ -<BR>public: -<BR>Client(char *hostname, int port):remote_addr_(hostname){ -<BR> remote_addr_.set_port_number(port); -<BR> data_buf_=new char[SIZE_BUF]; -<BR> } - -<P><FONT COLOR="#FF0000">//Uses a connector component connector_ to connect -to a remote machine</FONT> -<BR><FONT COLOR="#FF0000">//and pass the connection into a stream component -client_stream_</FONT> -<BR>int connect_to_server(){ -<BR> <FONT COLOR="#FF0000">// Initiate blocking connection with server.</FONT> -<BR> ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting connect to %s:%d\n", -<BR> remote_addr_.get_host_name(),remote_addr_.get_port_number())); -<BR> if (connector_.connect (client_stream_, remote_addr_) == -1) -<BR> ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %p\n","connection -failed"),-1); -<BR> else -<BR> ACE_DEBUG ((LM_DEBUG,"(%P|%t) connected to %s\n", -<BR> remote_addr_.get_host_name ())); -<BR> return 0; -<BR> } - -<P><FONT COLOR="#FF0000">//Uses a stream component to send data to the -remote host.</FONT> -<BR>int send_to_server(){ -<BR> <FONT COLOR="#FF0000"> // Send data to server</FONT> -<BR> ACE_OS::sprintf(data_buf_,"Hello from Client"); -<BR> for(int i=0;i<NO_ITERATIONS; i++){ -<BR> if (client_stream_.send_n -<BR> (data_buf_, ACE_OS::strlen(data_buf_), 0) == -1){ -<BR> ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %p\n","send_n"),0); -<BR> break; -<BR> } -<BR> } -<BR> <FONT COLOR="#FF0000">//Close down the connection</FONT> -<BR> close(); -<BR>} - -<P><FONT COLOR="#FF0000">//Close down the connection properly.</FONT> -<BR>int close(){ -<BR> if (client_stream_.close () == -1) -<BR> ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %p\n","close"),-1); -<BR> else -<BR> return 0; -<BR> } - -<P>private: -<BR> ACE_SOCK_Stream client_stream_; -<BR> ACE_INET_Addr remote_addr_; -<BR> ACE_SOCK_Connector connector_; -<BR> char *data_buf_; -<BR>}; - -<P>int main (int argc, char *argv[]){ -<BR> if(argc<3){ -<BR> ACE_DEBUG((LM_DEBUG,?Usage egX <hostname> <port_number>\n?)); -<BR> ACE_OS::exit(1); -<BR> } -<BR> Client client(argv[1],ACE_OS::atoi(argv[2])); -<BR> client.connect_to_server(); -<BR> client.send_to_server(); -<BR>} - -<P> <A HREF="ex03.html">Next Example</A> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_2/ex03.html b/docs/tutorials/Chap_2/ex03.html deleted file mode 100644 index 838eedcc81c..00000000000 --- a/docs/tutorials/Chap_2/ex03.html +++ /dev/null @@ -1,81 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 3</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess -Communication Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT><FONT COLOR="#FF0000"></FONT> - -<P><FONT COLOR="#CC0000">// Example 3</FONT><FONT COLOR="#FF0000"></FONT> - -<P><FONT COLOR="#FF0000">//Server</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/OS.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Dgram.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/INET_Addr.h"</FONT> - -<P><FONT COLOR="#000099">#define </FONT><FONT COLOR="#663366">DATA_BUFFER_SIZE -1024</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_DATA -18</FONT> - -<P>class Server{ -<BR>public: -<BR>Server(int local_port) -<BR> :local_addr_(local_port),local_(local_addr_){ -<BR> data_buf = new char[DATA_BUFFER_SIZE]; -<BR> } -<BR><FONT COLOR="#FF0000">//Expect data to arrive from the remote machine. -Accept it and display it.</FONT> -<BR><FONT COLOR="#FF0000">// After recieveing data immediately send some -data back to the remote.</FONT> -<BR>int accept_data(){ -<BR> while(local_.recv(data_buf,SIZE_DATA,remote_addr_)!=-1){ -<BR> ACE_DEBUG((LM_DEBUG, "Data received from remote %s was %s \n" -<BR> ,remote_addr_.get_host_name(), data_buf)); -<BR> ACE_OS::sleep(1); -<BR> if(send_data()==-1) break; -<BR> } -<BR> return -1; -<BR> } -<BR> -<BR> - -<P><FONT COLOR="#FF0000">//Method used to send data to the remote using -the datagram component local_</FONT> -<BR>int send_data(){ -<BR> ACE_DEBUG((LM_DEBUG,"Preparing to send reply to client %s:%d\n", -<BR> remote_addr_.get_host_name(),remote_addr_.get_port_number())); -<BR> ACE_OS::sprintf(data_buf,"Server says hello to you too"); -<BR> if( -<BR> local_.send(data_buf, ACE_OS::strlen(data_buf),remote_addr_)==-1) -<BR> return -1; -<BR> else -<BR> return 0; -<BR> } - -<P>private: -<BR> char *data_buf; -<BR> ACE_INET_Addr remote_addr_; -<BR> ACE_INET_Addr local_addr_; -<BR> ACE_SOCK_Dgram local_; -<BR>}; - -<P>int main(int argc, char *argv[]){ -<BR> Server server(ACE_OS::atoi(argv[1])); -<BR> server.accept_data(); -<BR>} - -<P> <A HREF="ex04.html">Next Example</A> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_2/ex04.html b/docs/tutorials/Chap_2/ex04.html deleted file mode 100644 index 16007f9c8f1..00000000000 --- a/docs/tutorials/Chap_2/ex04.html +++ /dev/null @@ -1,87 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 4</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess Communication -Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 4</FONT> -<BR><FONT COLOR="#FF0000">//Client</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/OS.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Dgram.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/INET_Addr.h"</FONT> - -<P><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">DATA_BUFFER_SIZE -1024</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">SIZE_DATA -28</FONT> -<BR>class Client{ -<BR>public: -<BR>Client(char * remote_addr,int port) -<BR> :remote_addr_(remote_addr), -<BR> local_addr_((u_short)0),local_(local_addr_){ -<BR> data_buf = new char[DATA_BUFFER_SIZE]; -<BR> remote_addr_.set_port_number(port); -<BR> } -<BR> -<BR><FONT COLOR="#FF0000">//Accept data from the remote host using the -datgram component local_</FONT> -<BR>int accept_data(){ -<BR> if(local_.recv(data_buf,SIZE_DATA,remote_addr_)!=-1){ -<BR> ACE_DEBUG((LM_DEBUG, "Data received from remote server %s -<BR> was: %s \n" ,remote_addr_.get_host_name(), -data_buf)); -<BR> return 0; -<BR> } -<BR> else -<BR> return -1; -<BR> } - -<P><FONT COLOR="#FF0000">//Send data to the remote. Once data has been -sent wait for a reply from</FONT> -<BR><FONT COLOR="#FF0000">//the server.</FONT> -<BR>int send_data(){ -<BR> ACE_DEBUG((LM_DEBUG,"Preparing to send data to server %s:%d\n", -<BR> remote_addr_.get_host_name(),remote_addr_.get_port_number())); -<BR> ACE_OS::sprintf(data_buf,"Client says hello"); -<BR> -<BR> while(local_.send -<BR> (data_buf,ACE_OS::strlen(data_buf),remote_addr_)!=-1){ -<BR> ACE_OS::sleep(1); -<BR> if(accept_data()==-1) -<BR> break; -<BR> } -<BR> return -1; -<BR> } - -<P>private: -<BR> char *data_buf; -<BR> ACE_INET_Addr remote_addr_; -<BR> ACE_INET_Addr local_addr_; -<BR> ACE_SOCK_Dgram local_; -<BR>}; - -<P>int main(int argc, char *argv[]){ -<BR>if(argc<3){ -<BR> ACE_OS::printf("Usage: Client hostname port_number \n"); -<BR> ACE_OS::exit(1); -<BR> } -<BR>Client client(argv[1],ACE_OS::atoi(argv[2])); -<BR>client.send_data(); -<BR>} -<BR> -<BR> <A HREF="ex05.html">Next Example</A> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_2/ex05.htm b/docs/tutorials/Chap_2/ex05.htm deleted file mode 100644 index 1a88e7c8dbd..00000000000 --- a/docs/tutorials/Chap_2/ex05.htm +++ /dev/null @@ -1,87 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 5</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess Communication -Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 5</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Dgram_Mcast.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/OS.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">DEFAULT_MULTICAST_ADDR -"224.9.9.2"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">TIMEOUT -5</FONT> - -<P>class Reciever_Multicast{ - -<P>public: -<BR>Reciever_Multicast(int port): -<BR> mcast_addr_(port,DEFAULT_MULTICAST_ADDR),remote_addr_((u_short)0){ -<BR> <FONT COLOR="#FF0000"> // Subscribe to multicast address.</FONT> -<BR> if (mcast_dgram_.subscribe (mcast_addr_) == -1){ -<BR> ACE_DEBUG((LM_DEBUG,"Error in subscribing to Multicast address -\n")); -<BR> exit(-1); -<BR> } -<BR>} - -<P>~Reciever_Multicast(){ -<BR> if(mcast_dgram_.unsubscribe()==-1) -<BR> ACE_DEBUG((LM_ERROR,?Error in unsubscribing from Mcast group\n?)); -<BR> } -<BR> -<BR> -<BR> - -<P><FONT COLOR="#FF0000">//Receive data from someone who is sending data -on the multicast group</FONT> -<BR><FONT COLOR="#FF0000">//address to do so it must use the multicast -datagram component</FONT> -<BR><FONT COLOR="#FF0000">//mcast_dgram_.</FONT> -<BR>int recv_multicast(){ -<BR><FONT COLOR="#FF0000"> //get ready to recieve data from the sender.</FONT> -<BR> if(mcast_dgram_.recv -<BR> (&mcast_info,sizeof (mcast_info),remote_addr_)==-1) -<BR> return -1; -<BR> ACE_DEBUG ((LM_DEBUG, "(%P|%t) Received multicast from %s:%d.\n", -<BR> remote_addr_.get_host_name(), remote_addr_.get_port_number())); -<BR> ACE_DEBUG((LM_DEBUG,"Successfully receieved %d\n", mcast_info)); -<BR> return 0; -<BR> } - -<P>private: -<BR> ACE_INET_Addr mcast_addr_; -<BR> ACE_INET_Addr remote_addr_; -<BR> ACE_SOCK_Dgram_Mcast mcast_dgram_; -<BR> int mcast_info; -<BR>}; -<BR> -<BR> -<BR>int main(int argc, char*argv[]){ -<BR> Reciever_Multicast m(2000); -<BR> <FONT COLOR="#FF0000">//Will run forever</FONT> -<BR> while(m.recv_multicast()!=-1) { -<BR> ACE_DEBUG((LM_DEBUG,"Multicaster succesful \n")); -<BR> } -<BR> -<BR> ACE_DEBUG((LM_ERROR,"Multicaster failed \n")); -<BR> exit(-1); -<BR>} - -<P> <A HREF="ex06.html">Next Example</A> -<BR> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_2/ex05.html b/docs/tutorials/Chap_2/ex05.html deleted file mode 100644 index 1a88e7c8dbd..00000000000 --- a/docs/tutorials/Chap_2/ex05.html +++ /dev/null @@ -1,87 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 5</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess Communication -Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 5</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/SOCK_Dgram_Mcast.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/OS.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">DEFAULT_MULTICAST_ADDR -"224.9.9.2"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">TIMEOUT -5</FONT> - -<P>class Reciever_Multicast{ - -<P>public: -<BR>Reciever_Multicast(int port): -<BR> mcast_addr_(port,DEFAULT_MULTICAST_ADDR),remote_addr_((u_short)0){ -<BR> <FONT COLOR="#FF0000"> // Subscribe to multicast address.</FONT> -<BR> if (mcast_dgram_.subscribe (mcast_addr_) == -1){ -<BR> ACE_DEBUG((LM_DEBUG,"Error in subscribing to Multicast address -\n")); -<BR> exit(-1); -<BR> } -<BR>} - -<P>~Reciever_Multicast(){ -<BR> if(mcast_dgram_.unsubscribe()==-1) -<BR> ACE_DEBUG((LM_ERROR,?Error in unsubscribing from Mcast group\n?)); -<BR> } -<BR> -<BR> -<BR> - -<P><FONT COLOR="#FF0000">//Receive data from someone who is sending data -on the multicast group</FONT> -<BR><FONT COLOR="#FF0000">//address to do so it must use the multicast -datagram component</FONT> -<BR><FONT COLOR="#FF0000">//mcast_dgram_.</FONT> -<BR>int recv_multicast(){ -<BR><FONT COLOR="#FF0000"> //get ready to recieve data from the sender.</FONT> -<BR> if(mcast_dgram_.recv -<BR> (&mcast_info,sizeof (mcast_info),remote_addr_)==-1) -<BR> return -1; -<BR> ACE_DEBUG ((LM_DEBUG, "(%P|%t) Received multicast from %s:%d.\n", -<BR> remote_addr_.get_host_name(), remote_addr_.get_port_number())); -<BR> ACE_DEBUG((LM_DEBUG,"Successfully receieved %d\n", mcast_info)); -<BR> return 0; -<BR> } - -<P>private: -<BR> ACE_INET_Addr mcast_addr_; -<BR> ACE_INET_Addr remote_addr_; -<BR> ACE_SOCK_Dgram_Mcast mcast_dgram_; -<BR> int mcast_info; -<BR>}; -<BR> -<BR> -<BR>int main(int argc, char*argv[]){ -<BR> Reciever_Multicast m(2000); -<BR> <FONT COLOR="#FF0000">//Will run forever</FONT> -<BR> while(m.recv_multicast()!=-1) { -<BR> ACE_DEBUG((LM_DEBUG,"Multicaster succesful \n")); -<BR> } -<BR> -<BR> ACE_DEBUG((LM_ERROR,"Multicaster failed \n")); -<BR> exit(-1); -<BR>} - -<P> <A HREF="ex06.html">Next Example</A> -<BR> -</BODY> -</HTML> diff --git a/docs/tutorials/Chap_2/ex06.html b/docs/tutorials/Chap_2/ex06.html deleted file mode 100644 index 94f40443766..00000000000 --- a/docs/tutorials/Chap_2/ex06.html +++ /dev/null @@ -1,76 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 6</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "IPC SAP" (Interprocess Communication -Mechanisms in ACE).</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#CC0000">//Example 6</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">DEFAULT_MULTICAST_ADDR -"224.9.9.2"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">TIMEOUT -5</FONT> -<BR><FONT COLOR="#000099">#include</FONT><FONT COLOR="#006600"> "ace/SOCK_Dgram_Mcast.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/OS.h"</FONT> - -<P>class Sender_Multicast{ -<BR>public: -<BR>Sender_Multicast(int port): -<BR> local_addr_((u_short)0),dgram_(local_addr_), -<BR> multicast_addr_(port,DEFAULT_MULTICAST_ADDR){} - -<P><FONT COLOR="#FF0000">//Method which uses a simple datagram component -to send data to the multicast group.</FONT> -<BR>int send_to_multicast_group(){ -<BR> <FONT COLOR="#FF0000">//Convert the information we wish -to send into network byte order</FONT> -<BR> mcast_info= htons (1000); - -<P><FONT COLOR="#FF0000"> // Send multicast</FONT> -<BR> if(dgram_.send -<BR> (&mcast_info, sizeof (mcast_info), multicast_addr_)==-1) -<BR> return -1; - -<P> ACE_DEBUG ((LM_DEBUG, -<BR> -"%s; Sent multicast to group. Number sent is %d.\n", -<BR> -__FILE__, -<BR> -mcast_info)); -<BR> return 0; -<BR>} - -<P>private: -<BR> ACE_INET_Addr multicast_addr_; -<BR> ACE_INET_Addr local_addr_; -<BR> ACE_SOCK_Dgram dgram_; -<BR> int mcast_info; -<BR>}; -<BR> - -<P>int main(int argc, char*argv[]){ -<BR>Sender_Multicast m(2000); -<BR>if(m.send_to_multicast_group()==-1) { -<BR> ACE_DEBUG((LM_ERROR,"Send to Multicast group failed \n")); -<BR> exit(-1); -<BR> } -<BR>else -<BR> ACE_DEBUG((LM_DEBUG,"Send to Multicast group succesful \n")); -<BR>} - -<P> <A HREF="../Chap_3/ex01.html">Next Example</A> -</BODY> -</HTML> |