summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgthaker <gthaker@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-02-24 14:31:47 +0000
committergthaker <gthaker@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-02-24 14:31:47 +0000
commit68c32c49c7240b6c47d1dedc2fd915506c96c529 (patch)
tree56ce801ab078c34045cc862be12c687e82e6823c
parentde5572000f2c391bc1e691aeafcc5604c3c50331 (diff)
downloadATCD-68c32c49c7240b6c47d1dedc2fd915506c96c529.tar.gz
The CDR-encoded numIterations is now preceded by a CDR-encoded Boolean
that tells the server the byte order of numIterations. The message-buffer size is now decoded from network byte order after being received from the client.
-rw-r--r--performance-tests/SCTP/SOCK_SEQPACK_srv.cpp11
-rw-r--r--performance-tests/SCTP/SOCK_STREAM_srv.cpp11
2 files changed, 16 insertions, 6 deletions
diff --git a/performance-tests/SCTP/SOCK_SEQPACK_srv.cpp b/performance-tests/SCTP/SOCK_SEQPACK_srv.cpp
index 94578e5ad70..c09f518e084 100644
--- a/performance-tests/SCTP/SOCK_SEQPACK_srv.cpp
+++ b/performance-tests/SCTP/SOCK_SEQPACK_srv.cpp
@@ -52,6 +52,7 @@ static ACE_THR_FUNC_RETURN unmarshalledOctetServer (void *arg){
"%p\n",
"recv_n"),
0);
+ msgBufSize = ACE_NTOHL(msgBufSize);
// allocate the buffer for the message payload
ACE_CDR::Octet * msgBuf=NULL;
@@ -134,8 +135,9 @@ static void run_server (ACE_HANDLE handle)
cli_addr.get_host_name (),
cli_addr.get_port_number ()));
- // hdr bufSize is hardcoded to 4 (4 bytes for a CDR encoded long)
- ACE_CDR::ULong hdrBufSize=4;
+ // hdr bufSize is hardcoded to 8 bytes
+ // (4 for a CDR-encoded boolean and 4 for a CDR-encoded ULong)
+ ACE_CDR::ULong hdrBufSize = 8;
// allocate a raw buffer large enough to receive the header and be
// properly aligned for the CDR decoding.
ACE_CDR::Char * hdrBuf= new ACE_CDR::Char[hdrBufSize+ACE_CDR::MAX_ALIGNMENT];
@@ -143,7 +145,7 @@ static void run_server (ACE_HANDLE handle)
char * hdrBuf_a = ACE_ptr_align_binary(hdrBuf, ACE_CDR::MAX_ALIGNMENT);
size_t bt;
- // read the size of the header
+ // read the header
if ((dataModeStream->recv_n(hdrBuf_a, hdrBufSize, 0, &bt)) == -1){
ACE_ERROR ((LM_ERROR,
"%p\n",
@@ -156,9 +158,12 @@ static void run_server (ACE_HANDLE handle)
// remains valid while it is in scope.
ACE_InputCDR hdrCDR(hdrBuf_a, hdrBufSize);
+ ACE_CDR::Boolean byteOrder;
ACE_CDR::ULong numIterations;
// extract the data
+ hdrCDR >> ACE_InputCDR::to_boolean (byteOrder);
+ hdrCDR.reset_byte_order(byteOrder);
hdrCDR >> numIterations;
// make sure the stream is good after the extractions
diff --git a/performance-tests/SCTP/SOCK_STREAM_srv.cpp b/performance-tests/SCTP/SOCK_STREAM_srv.cpp
index 5b62b0e6a4a..a5bbce9fffd 100644
--- a/performance-tests/SCTP/SOCK_STREAM_srv.cpp
+++ b/performance-tests/SCTP/SOCK_STREAM_srv.cpp
@@ -52,6 +52,7 @@ static ACE_THR_FUNC_RETURN unmarshalledOctetServer (void *arg){
"%p\n",
"recv_n"),
0);
+ msgBufSize = ACE_NTOHL(msgBufSize);
// allocate the buffer for the message payload
ACE_CDR::Octet * msgBuf=NULL;
@@ -144,8 +145,9 @@ static void run_server (ACE_HANDLE handle)
cli_addr.get_host_name (),
cli_addr.get_port_number ()));
- // hdr bufSize is hardcoded to 4 (4 bytes for a CDR encoded long)
- ACE_CDR::ULong hdrBufSize=4;
+ // hdr bufSize is hardcoded to 8 bytes
+ // (4 for a CDR-encoded boolean and 4 for a CDR-encoded ULong)
+ ACE_CDR::ULong hdrBufSize = 8;
// allocate a raw buffer large enough to receive the header and be
// properly aligned for the CDR decoding.
ACE_CDR::Char * hdrBuf= new ACE_CDR::Char[hdrBufSize+ACE_CDR::MAX_ALIGNMENT];
@@ -153,7 +155,7 @@ static void run_server (ACE_HANDLE handle)
char * hdrBuf_a = ACE_ptr_align_binary(hdrBuf, ACE_CDR::MAX_ALIGNMENT);
size_t bt;
- // read the size of the header
+ // read the header
if ((dataModeStream->recv_n(hdrBuf_a, hdrBufSize, 0, &bt)) == -1){
ACE_ERROR ((LM_ERROR,
"%p\n",
@@ -166,9 +168,12 @@ static void run_server (ACE_HANDLE handle)
// remains valid while it is in scope.
ACE_InputCDR hdrCDR(hdrBuf_a, hdrBufSize);
+ ACE_CDR::Boolean byteOrder;
ACE_CDR::ULong numIterations;
// extract the data
+ hdrCDR >> ACE_InputCDR::to_boolean (byteOrder);
+ hdrCDR.reset_byte_order(byteOrder);
hdrCDR >> numIterations;
// make sure the stream is good after the extractions