2

HI there I am trying to use a Python client to send a 'buy' message to Java strategy found in my Dukascopy JForex demo account. This Java socket strategy was found here

https://www.dukascopy.com/wiki/en/development/strategy-api/practices/socket-connection

I am able to get both Java JForex strategy code working with client Java code with no issue. When I try to do the same with Python, there is no connection for some reason. Here is the modified Python code:

#http://stackoverflow.com/questions/7749341/very-basic-python-client-socket-example

import socket

clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.connect(('localhost', 7001))
clientsocket.send('BUY')
clientsocket.close()

Question is what do you think is wrong? I can only think of is what parameters I use to set up the socket connection. Please let me know what you think. Thanks

Bryan Downing
  • 207
  • 2
  • 14
  • Are you getting an error? Is your firewall blocking the port? Are you sure that port is available? Both are running on the same machine, correct? How do you know the Java has 'no issue'? What OS are you running? – RobertB Feb 01 '17 at 01:23
  • Everything is local. I can test to see if the connection is refused from within my Python client. I am also on macOS latest version. As for the test of Java test client with a JForex Java strategy, I was able generate an order as expected in the Dukascopy wiki link above. – Bryan Downing Feb 01 '17 at 01:54
  • Check your firewall and make sure that port 7001 is allowed for traffic. Does mac have `netstat`? If so, kill your server and then run `netstat` and make sure nothing else is running on that port. – RobertB Feb 01 '17 at 05:15
  • I doubt Firewall can be a issues due to (as explained above): I am able to get both Java JForex strategy code working with client Java code with no issue – Bryan Downing Feb 01 '17 at 05:45

0 Answers0