|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Communicate between 64 bit client and 32 bit server |
« View previous topic :: View next topic » |
Author |
Message
|
shantha |
Posted: Mon Jul 12, 2004 4:08 am Post subject: Communicate between 64 bit client and 32 bit server |
|
|
Apprentice
Joined: 11 Dec 2003 Posts: 41
|
Hi all,
Our application is running on Websphere using websphere MQ on unix.
Currently we are facing problem while using MQ series to communicate between a 64 bit client and 32 bit server.
CAn any one please help me on this
Thanks in advance
Shantha |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 12, 2004 4:25 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What problem are you facing?
Are you getting a return code? What is it? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
shantha |
Posted: Mon Jul 12, 2004 8:58 pm Post subject: |
|
|
Apprentice
Joined: 11 Dec 2003 Posts: 41
|
I have attached below the sample programs being used for simulating the problem .The sample programs works fine when we compile the Client code with 32 Bit Libraries(ie , both Server and Client are 32 Bit).
We have requirement of migrating MQ application from HP-UX 32 bit to 64 Bit. We have compiled the same sample code with downloaded 64 Bit MQ Client libraries. MQCONN fails with return code of 2058 when we try to connect 64 Bit Client to 32 Bit MQ server. Can a MQ 64 Bit Client talk to 32 Bit MQ server?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* includes for MQI */
#include <cmqc.h>
int main(int argc, char **argv)
{
/* Declare file and character for sample input */
FILE *fp;
/* Declare MQI structures needed */
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
/** note, sample uses defaults where it can **/
MQHCONN Hcon; /* connection handle */
MQHOBJ Hobj; /* object handle */
MQLONG O_options; /* MQOPEN options */
MQLONG C_options; /* MQCLOSE options */
MQLONG CompCode; /* completion code */
MQLONG OpenCode; /* MQOPEN completion code */
MQLONG Reason; /* reason code */
MQLONG CReason; /* reason code for MQCONN */
MQLONG messlen; /* message length */
char buffer[100]; /* message buffer */
char QMName[50]; /* queue manager name */
printf("Sample AMQSPUT0 start\n");
if (argc < 2)
{
printf("Required parameter missing - queue name\n");
exit(99);
}
/******************************************************************/
/* */
/* Connect to queue manager */
/* */
/******************************************************************/
QMName[0] = 0; /* default */
if (argc > 2)
strcpy(QMName, argv[2]);
MQCONN(QMName, /* queue manager */
&Hcon, /* connection handle */
&CompCode, /* completion code */
&CReason); /* reason code */
/* report reason and stop if it failed */
if (CompCode == MQCC_FAILED)
{
printf("MQCONN ended with reason code %d\n", CReason);
exit( (int)CReason );
}
/******************************************************************/
/* */
/* Use parameter as the name of the target queue */
/* */
/******************************************************************/
strncpy(od.ObjectName, argv[1], (size_t)MQ_Q_NAME_LENGTH);
printf("target queue is %s\n", od.ObjectName);
if (argc > 5)
{
strncpy(od.ObjectQMgrName, argv[5], (size_t) MQ_Q_MGR_NAME_LENGTH);
printf("target queue manager is %s\n", od.ObjectQMgrName);
}
if (argc > 6)
{
strncpy(od.DynamicQName, argv[6], (size_t) MQ_Q_NAME_LENGTH);
printf("dynamic queue name is %s\n", od.DynamicQName);
}
/******************************************************************/
/* */
/* Open the target message queue for output */
/* */
/******************************************************************/
if (argc > 3)
{
O_options = atoi( argv[3] );
printf("open options are %d\n", O_options);
}
else
{
O_options = MQOO_OUTPUT /* open queue for output */
| MQOO_FAIL_IF_QUIESCING /* but not if MQM stopping */
; /* = 0x2010 = 8208 decimal */
}
MQOPEN(Hcon, /* connection handle */
&od, /* object descriptor for queue */
O_options, /* open options */
&Hobj, /* object handle */
&OpenCode, /* MQOPEN completion code */
&Reason); /* reason code */
/* report reason, if any; stop if failed */
if (Reason != MQRC_NONE)
{
printf("MQOPEN ended with reason code %d\n", Reason);
}
if (OpenCode == MQCC_FAILED)
{
printf("unable to open queue for output\n");
}
/******************************************************************/
/* */
/* Read lines from the file and put them to the message queue */
/* Loop until null line or end of file, or there is a failure */
/* */
/******************************************************************/
CompCode = OpenCode; /* use MQOPEN result for initial test */
fp = stdin;
memcpy(md.Format, /* character string format */
MQFMT_STRING, (size_t)MQ_FORMAT_LENGTH);
/******************************************************************/
/* Use these options when connecting to Queue Managers that also */
/* support them, see the Application Programming Reference for */
/* details. */
/* These options cause the MsgId and CorrelId to be replaced, so */
/* that there is no need to reset them before each MQPUT */
/******************************************************************/
/* pmo.Options |= MQPMO_NEW_MSG_ID; */
/* pmo.Options |= MQPMO_NEW_CORREL_ID; */
while (CompCode != MQCC_FAILED)
{
if (fgets(buffer, sizeof(buffer), fp) != NULL)
{
messlen = (MQLONG)strlen(buffer); /* length without null */
if (buffer[messlen-1] == '\n') /* last char is a new-line */
{
buffer[messlen-1] = '\0'; /* replace new-line with null */
--messlen; /* reduce buffer length */
}
}
else messlen = 0; /* treat EOF same as null line */
/****************************************************************/
/* */
/* Put each buffer to the message queue */
/* */
/****************************************************************/
if (messlen > 0)
{
/**************************************************************/
/* The following two statements are not required if the */
/* MQPMO_NEW_MSG_ID and MQPMO_NEW _CORREL_ID options are used */
/**************************************************************/
memcpy(md.MsgId, /* reset MsgId to get a new one */
MQMI_NONE, sizeof(md.MsgId) );
memcpy(md.CorrelId, /* reset CorrelId to get a new one */
MQCI_NONE, sizeof(md.CorrelId) );
MQPUT(Hcon, /* connection handle */
Hobj, /* object handle */
&md, /* message descriptor */
&pmo, /* default options (datagram) */
messlen, /* message length */
buffer, /* message buffer */
&CompCode, /* completion code */
&Reason); /* reason code */
/* report reason, if any */
if (Reason != MQRC_NONE)
{
printf("MQPUT ended with reason code %d\n", Reason);
}
}
else /* satisfy end condition when empty line is read */
CompCode = MQCC_FAILED;
}
/******************************************************************/
/* */
/* Close the target queue (if it was opened) */
/* */
/******************************************************************/
if (OpenCode != MQCC_FAILED)
{
if (argc > 4)
{
C_options = atoi( argv[4] );
printf("close options are %d\n", C_options);
}
else
{
C_options = MQCO_NONE; /* no close options */
}
MQCLOSE(Hcon, /* connection handle */
&Hobj, /* object handle */
C_options,
&CompCode, /* completion code */
&Reason); /* reason code */
/* report reason, if any */
if (Reason != MQRC_NONE)
{
printf("MQCLOSE ended with reason code %d\n", Reason);
}
}
/******************************************************************/
/* */
/* Disconnect from MQM if not already connected */
/* */
/******************************************************************/
if (CReason != MQRC_ALREADY_CONNECTED)
{
MQDISC(&Hcon, /* connection handle */
&CompCode, /* completion code */
&Reason); /* reason code */
/* report reason, if any */
if (Reason != MQRC_NONE)
{
printf("MQDISC ended with reason code %d\n", Reason);
}
}
/******************************************************************/
/* */
/* END OF AMQSPUT0 */
/* */
/******************************************************************/
printf("Sample AMQSPUT0 end\n");
return(0);
}
Thanks in advance
Shantha |
|
Back to top |
|
 |
JasonE |
Posted: Tue Jul 13, 2004 1:16 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
Make sure you are using the latest 64 bit client download, but you are correct - a 64 bit client should talk to a 32 bit server without any problems at all.
As to what the problem is, good question... A random guess which could be very off-target - Are you sure you picked up the 64bit header files? |
|
Back to top |
|
 |
muralihegde |
Posted: Tue Aug 24, 2004 6:11 pm Post subject: |
|
|
Centurion
Joined: 30 Apr 2002 Posts: 108
|
Hi,
One probable reason for 2058 is that your application is not able to resolve the queue manager name.
Please remember that your application is now behaving like a client program to MQ Q Mannager and not like a server application.
You might have to use the MQSERVER environment variable and set up a server connection channel as well and export the env variable as ..
export MQSERVER=TEST1.SVRCONN/TCP/HostnameOfYourMachine
The other option would be to make use of the MQCHL table.
Please refer to MQ manuals on mq client connectivity to the server. Even though you are connecting to a MQ Server on the same box, since you are using the client libraries, it is as good as mq client connectivity to the server.
-Hope this helps.. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|