Commit 514c29f0 authored by Günter Windau's avatar Günter Windau

zmq stuff

parent ecee522d
......@@ -11,4 +11,9 @@ function ip = getip(hostname)
% (http://www.codeguru.com/network/local_hostname.shtml) and
% tcp_udp_ip toolbox by Peter Rydester (Peter.Rydesater@mh.se)
error('You need to compile getip.c to an mex file for your platform. Read header of getip.c');
% Gnter Windau: 20200904 added python workaround if mex file is missing
warning('You need to compile getip.c to an mex file for your platform. Read header of getip.c');
warning('Trying to use python2/3 workaround');
ip=gethostbyname(hostname);
\ No newline at end of file
......@@ -5,6 +5,7 @@ classdef lsldert_pubclient < lsldert_abstract_client
context;
socket;
hostname;
hostip;
tmax = Inf;
end
......@@ -27,7 +28,12 @@ classdef lsldert_pubclient < lsldert_abstract_client
hostname = this.default_hostname;
end
this.hostname=hostname;
this.hostip=gethostbyname(this.hostname);
if isempty(this.hostip)
ME = MException('lsldert_pubclient:hostname_lookup_failure',...
'cannot resolve IP address for host %s ', hostname);
throw(ME);
end
% zmq workaround to prevent infinite wait:
% probe if hostname:port is available
con=pnet('tcpconnect',hostname,port);
......@@ -41,7 +47,7 @@ classdef lsldert_pubclient < lsldert_abstract_client
this.context=ZMQ.context(1);
this.socket=this.context.socket(ZMQ.PUB);
uri=sprintf('tcp://%s:%d',hostname,port);
uri=sprintf('tcp://%s:%d',this.hostip,port);
this.socket.connect(uri);
this.socket.getReceiveTimeOut();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment