Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
412864a5
Commit
412864a5
authored
19 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
46094ed5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Fltk/GmshServer.h
+15
-1
15 additions, 1 deletion
Fltk/GmshServer.h
Fltk/Solvers.cpp
+1
-20
1 addition, 20 deletions
Fltk/Solvers.cpp
utils/solvers/c++/GmshClient.h
+16
-1
16 additions, 1 deletion
utils/solvers/c++/GmshClient.h
utils/solvers/c/GmshClient.c
+19
-3
19 additions, 3 deletions
utils/solvers/c/GmshClient.c
with
51 additions
and
25 deletions
Fltk/GmshServer.h
+
15
−
1
View file @
412864a5
...
...
@@ -39,14 +39,24 @@ int WaitForData(int socket, int num, int pollint, double waitint);
#if defined(_AIX)
#include
<strings.h>
#endif
#if !defined(WIN32) || defined(__CYGWIN__)
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<sys/stat.h>
#include
<sys/poll.h>
#include
<sys/un.h>
#include
<sys/time.h>
#include
<unistd.h>
#include
<netinet/in.h>
#else // pure windows
#include
<winsock2.h>
#endif
class
GmshServer
{
public:
// This should match what's in GmshClient.h
...
...
@@ -74,7 +84,7 @@ class GmshServer {
int
sofar
=
0
;
int
remaining
=
bytes
;
do
{
in
t
len
=
re
ad
(
_sock
,
buf
+
sofar
,
remaining
);
ssize_
t
len
=
re
cv
(
_sock
,
buf
+
sofar
,
remaining
,
0
);
if
(
len
<=
0
)
return
0
;
sofar
+=
len
;
...
...
@@ -132,7 +142,9 @@ class GmshServer {
if
(
_portno
<
0
){
// delete the file if it already exists
#if !defined(WIN32) || defined(__CYGWIN__)
unlink
(
_sockname
);
#endif
// make the socket
s
=
socket
(
PF_UNIX
,
SOCK_STREAM
,
0
);
...
...
@@ -218,8 +230,10 @@ class GmshServer {
{
if
(
_portno
<
0
){
// UNIX socket
#if !defined(WIN32) || defined(__CYGWIN__)
if
(
unlink
(
_sockname
)
==
-
1
)
return
-
1
;
// Impossible to unlink the socket
#endif
}
close
(
_sock
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Fltk/Solvers.cpp
+
1
−
20
View file @
412864a5
// $Id: Solvers.cpp,v 1.
39
2005-0
8-31 21:44:44
geuzaine Exp $
// $Id: Solvers.cpp,v 1.
40
2005-0
9-25 18:51:27
geuzaine Exp $
//
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -24,8 +24,6 @@
SolverInfo
SINFO
[
MAXSOLVERS
];
#if !defined(WIN32) || defined(__CYGWIN__)
#include
"GmshServer.h"
// FIXME: this should be removed (and we should set the socket options
...
...
@@ -33,13 +31,6 @@ SolverInfo SINFO[MAXSOLVERS];
int
GmshServer
::
init
=
0
;
int
GmshServer
::
s
;
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<sys/stat.h>
#include
<sys/poll.h>
#include
<sys/un.h>
#include
<unistd.h>
#include
"OpenFile.h"
#include
"GmshUI.h"
#include
"GUI.h"
...
...
@@ -281,13 +272,3 @@ int Solver(int num, char *args)
return
1
;
}
#else // pure windows
int
Solver
(
int
num
,
char
*
args
)
{
Msg
(
GERROR
,
"Solver interface not available on Windows without Cygwin"
);
return
1
;
}
#endif
This diff is collapsed.
Click to expand it.
utils/solvers/c++/GmshClient.h
+
16
−
1
View file @
412864a5
...
...
@@ -33,6 +33,9 @@
#ifdef _AIX
#include
<strings.h>
#endif
#if !defined(WIN32) || defined(__CYGWIN__)
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<sys/stat.h>
...
...
@@ -42,6 +45,12 @@
#include
<netinet/in.h>
#include
<netdb.h>
#else // pure windows
#include
<winsock2.h>
#endif
class
GmshClient
{
private:
typedef
enum
{
CLIENT_START
=
1
,
...
...
@@ -63,7 +72,7 @@ class GmshClient {
int
sofar
=
0
;
int
remaining
=
bytes
;
do
{
in
t
len
=
write
(
_sock
,
buf
+
sofar
,
remaining
);
ssize_
t
len
=
send
(
_sock
,
buf
+
sofar
,
remaining
,
0
);
sofar
+=
len
;
remaining
-=
len
;
}
while
(
remaining
>
0
);
...
...
@@ -77,17 +86,23 @@ class GmshClient {
}
long
_GetTime
()
{
#if !defined(WIN32) || defined(__CYGWIN__)
struct
timeval
tp
;
gettimeofday
(
&
tp
,
(
struct
timezone
*
)
0
);
return
(
long
)
tp
.
tv_sec
*
1000000
+
(
long
)
tp
.
tv_usec
;
#else
return
0
;
#endif
}
void
_Idle
(
double
delay
)
{
#if !defined(WIN32) || defined(__CYGWIN__)
long
t1
=
_GetTime
();
while
(
1
)
{
if
(
_GetTime
()
-
t1
>
1.e6
*
delay
)
break
;
}
#endif
}
public
:
GmshClient
()
:
_sock
(
0
)
{}
...
...
This diff is collapsed.
Click to expand it.
utils/solvers/c/GmshClient.c
+
19
−
3
View file @
412864a5
/* $Id: GmshClient.c,v 1.
3
2005-0
1-16 20:56:03
geuzaine Exp $ */
/* $Id: GmshClient.c,v 1.
4
2005-0
9-25 18:51:27
geuzaine Exp $ */
/*
* Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
*
...
...
@@ -36,6 +36,9 @@
#ifdef _AIX
#include
<strings.h>
#endif
#if !defined(WIN32) || defined(__CYGWIN__)
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<sys/stat.h>
...
...
@@ -45,17 +48,24 @@
#include
<netinet/in.h>
#include
<netdb.h>
#else
/* pure windows */
#include
<winsock2.h>
#endif
/* private functions */
static
void
Socket_SendData
(
int
socket
,
void
*
buffer
,
int
bytes
)
{
int
sofar
,
remaining
,
len
;
ssize_t
len
;
int
sofar
,
remaining
;
char
*
buf
;
buf
=
(
char
*
)
buffer
;
sofar
=
0
;
remaining
=
bytes
;
do
{
len
=
write
(
socket
,
buf
+
sofar
,
remaining
);
len
=
send
(
socket
,
buf
+
sofar
,
remaining
,
0
);
sofar
+=
len
;
remaining
-=
len
;
}
while
(
remaining
>
0
);
...
...
@@ -63,18 +73,24 @@ static void Socket_SendData(int socket, void *buffer, int bytes)
static
long
Socket_GetTime
()
{
#if !defined(WIN32) || defined(__CYGWIN__)
struct
timeval
tp
;
gettimeofday
(
&
tp
,
(
struct
timezone
*
)
0
);
return
(
long
)
tp
.
tv_sec
*
1000000
+
(
long
)
tp
.
tv_usec
;
#else
return
0
;
#endif
}
static
void
Socket_Idle
(
double
delay
)
{
#if !defined(WIN32) || defined(__CYGWIN__)
long
t1
=
Socket_GetTime
();
while
(
1
)
{
if
(
Socket_GetTime
()
-
t1
>
1.e6
*
delay
)
break
;
}
#endif
}
/* public interface */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment