Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if(MSVC)
target_compile_options(${PLUGIN_NAME} PRIVATE /sdl- /W0)

install(TARGETS ${PLUGIN_NAME} RUNTIME DESTINATION ${GUI_BIN_DIR}/plugins CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
install(FILES $<TARGET_PDB_FILE:${PLUGIN_NAME}> DESTINATION ${GUI_BIN_DIR}/plugins OPTIONAL)

set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../libs)
elseif(LINUX)
Expand Down
12 changes: 9 additions & 3 deletions Resources/python-example-tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
oneCycle = np.concatenate((intList_1, intList_2))
allData = np.tile(oneCycle, (numChannels, totalDuration)).T

# ---- WAIT FOR USER INPUT ---- #
value = input("Press enter key to start...")

# ---- CREATE THE SOCKET SERVER ---- #
tcpServer = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM)
tcpServer.bind(('localhost', 9001))
tcpServer.listen(1)

# ---- WAIT FOR USER INPUT ---- #
value = input("Press enter key to start...")

print("Waiting for external connection to start...")
(tcpClient, address) = tcpServer.accept()
print("Connected.")
Expand Down Expand Up @@ -75,3 +75,9 @@ def currentTime():
print("Done")
except BrokenPipeError:
print("Connection closed by the server. Unable to send data. Exiting...")

except ConnectionAbortedError:
print("Connection was aborted, unable to send data. Try disconnecting and reconnecting the remote client. Exiting...")

except ConnectionResetError:
print("Connection was aborted, unable to send data. Try disconnecting and reconnecting the remote client. Exiting...")
2 changes: 2 additions & 0 deletions Source/EphysSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ void EphysSocket::registerParameters()

void EphysSocket::disconnectSocket()
{
socket.signalThreadShouldExit();
socket.waitForThreadToExit(1000);
socket.disconnectSocket();

getParameter ("port")->setEnabled (true);
Expand Down
2 changes: 1 addition & 1 deletion Source/OpenEphysLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" EXPORT void getLibInfo (Plugin::LibraryInfo* info)
{
info->apiVersion = PLUGIN_API_VER;
info->name = "Ephys Socket";
info->libVersion = "0.5.0";
info->libVersion = "0.5.1";
info->numPlugins = NUM_PLUGINS;
}

Expand Down
5 changes: 5 additions & 0 deletions Source/SocketThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ void SocketThread::startAcquisition()
void SocketThread::stopAcquisition()
{
acquiring = false;

if (shouldReconnect)
{
processor->disconnectSocket();
}
}

bool SocketThread::connectSocket (int port, bool printOutput)
Expand Down
Loading