Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-06-03 13:33:40 +0000
committerJuergen Haug2015-06-03 13:33:40 +0000
commit9ce9447c7f97818cdf2b1009b3c0930a4af5b766 (patch)
treef8a3ab3a922818a4abfcc3f0f258e2d1bb930dde /runtime/org.eclipse.etrice.runtime.c/src/platforms
parentc80edce745dd097625a050957f03f4be460b4045 (diff)
downloadorg.eclipse.etrice-9ce9447c7f97818cdf2b1009b3c0930a4af5b766.tar.gz
org.eclipse.etrice-9ce9447c7f97818cdf2b1009b3c0930a4af5b766.tar.xz
org.eclipse.etrice-9ce9447c7f97818cdf2b1009b3c0930a4af5b766.zip
[modellib.c] fixes and changes for mingw tcp service
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c
index 79a2ec85e..e650175d1 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c
@@ -110,6 +110,7 @@ static void listenerThreadFunc(void* threadData) {
"etSocketServer",
readThreadFunc,
&self->connections[slot]);
+ etThread_start(&self->connections[slot].readThread);
}
/* TODO: if maxConnections is reached this thread terminates.
@@ -141,6 +142,7 @@ etSocketError etCleanupSockets() {
etSocketServerData* etCreateSocketServerData() {
etSocketServerDataImpl* data = malloc(sizeof(etSocketServerDataImpl));
memset(data, 0, sizeof(etSocketServerDataImpl));
+ data->data.maxConnections = MAX_CONNECTIONS;
return &data->data;
}
@@ -189,6 +191,7 @@ etSocketError etStartListening(etSocketServerData* data, short port) {
"etSocketServer",
listenerThreadFunc,
self);
+ etThread_start(&self->listenerThread);
return ETSOCKET_OK;
}
@@ -215,6 +218,7 @@ etSocketError etWriteServerSocket(etSocketServerData* dat, int connection, int s
while (size>0) {
int sent = send(self->connections[connection].socket, ((int8*)data)+offset, size, 0);
+
if (sent<=0)
return ETSOCKET_ERROR;
@@ -286,7 +290,7 @@ etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, sh
self->address.sin_family = host->h_addrtype;
self->address.sin_port = htons(port);
- self->socket = socket(AF_INET, SOCK_STREAM, 0);
+ self->socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (self->socket==INVALID_SOCKET)
return ETSOCKET_ERROR;
@@ -303,6 +307,7 @@ etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, sh
"etSocketConnection",
readThreadFunc,
self);
+ etThread_start(&self->readThread);
return ETSOCKET_OK;
}
@@ -313,6 +318,7 @@ etSocketError etWriteSocket(etSocketConnectionData* dat, int size, const int8* d
while (size>0) {
int sent = send(self->socket, ((int8*)data)+offset, size, 0);
+
if (sent<=0)
return ETSOCKET_ERROR;

Back to the top