Connecting to MQ using python
DiggBlinkRedditDeliciousTechnorati
question by ashraf ghannam | Moderate
Hello all python lovers,
Is there a way in which I can build a client that connects to IBM websphere MQ without using MQ client , I mean without using something like pymqi , I am thinking of something like sockets , a solution in C++ will be also ok.
Thanks
Post reply
Subscriptions
Re: Connecting to MQ using pythonreply by Bejaan Here are some Socket examples:
>>> import socket
>>> mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
...
...
>>> mySocket.connect ( ( 'localhost', 2727 ) )
>>> mySocket.send ( 'William Shakespeare' )
>>> mySocket.recv ( 100 )
>>> mySocket.close()
...
...
import socket
mySocket = socket.socket ( socket.AF_INET, socket.SOCK_DGRAM )
mySocket.bind ( ( '', 2727 ) )
while True:
data, client = mySocket.recvfrom ( 100 )
print 'We have received a datagram from', client
print data
mySocket.sendto ( 'Green-eyed datagram.', client )
...
...
>>> import socket
>>> mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
>>> mySocket.sendto ( 'Wherefore art thou?', ( 'localhost', 2727 ) )
>>> data, server = mySocket.recvfrom ( 100 )
>>> print data
You can check out the actual docs at: http://docs.python.org/lib/module-socket.html
Post reply
Subscriptions
Got a Python Question?
Just Sign Up and ask the top Python experts!
|