[FieldTrip] Realtime buffer - possible to spawn multiple buffer threads using non-default values for host and port?

David Painter d.painter1 at uq.edu.au
Tue Apr 4 03:41:09 CEST 2017


Dear Fieldtrippers,


I've been using Fieldtrip's buffer.exe in conjunction with biosemi2ft.exe to read EEG data in realtime.


I'd like to use buffer.exe to communicate EEG analysis results between Matlab sessions. I was wondering whether it's possible to spawn multiple buffer threads on separate ports? Host 'localhost' and port 1972 are already occupied by reading data from the amplifier. I'd like to use a separate port for additional communication during neurofeedback, but the only value for "port" that seems to work is 1972. "Host" accepts the values of 'localhost' and the current ip4 config address of the computer but can't seem to allow remote connections.


Does anyone know if host and port can accept values other than "localhost" and "1972"?


I couldn't many explicit examples on this procedure online, so I've posted my code for future reference.


David

University of Queensland

Windows 7 & 10, 64-bit - Matlab R2016b  64-bit


% matlab code


% direct.realtime ---> where buffer.exe and related files are located:

% buffer.exe

% pthreadGC2-w64.dll
% buffer.mexw32

% pthreadGC2.dll
% Labview_DLL.dll

% buffer.mexw64
% biosemi2ft.exe

% libgcc_s_dw2-1.dll
% biosemi_config.txt

% libstdc++-6.dll

!taskkill /F /IM cmd.exe /T
!taskkill /F /IM buffer.exe /T
system( ['e: -& cd "' direct.realtime '" & buffer.exe -&'] ); % start buffer.exe

cfg.host = 'localhost'; % <---- CAN THESE VALUES CHANGE?
cfg.port = uint32( 1972 ); % <----- CAN THESE VALUES CHANGE?

cfg.nchans = uint32( 1 );
dat.nchans = uint32( 32 );
dat.nsamples = uint32( 200 );
dat.nevents = uint32( 0 );
dat.fsample = uint32( 200 );
dat.data_type = uint32( 9 ); % single precision data
dat.bufsize = uint32( dat.nsamples * dat.nchans * 4 );
dat.buf = single( rand(dat.nsamples,dat.nchans ) );

buffer('put_hdr', dat, cfg.host, cfg.port);
% hdr = buffer('get_hdr', [], cfg.host, cfg.port); % ----- read header
buffer('put_dat', dat, cfg.host, cfg.port);
% hdr = buffer('get_hdr', [], cfg.host, cfg.port); % ----- read header

begsample = 1;
endsample = 200;

dat = buffer('get_dat', [begsample-1 endsample-1], cfg.host, cfg.port);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170404/235a2317/attachment-0001.html>


More information about the fieldtrip mailing list