File: xstream.gd

package info (click to toggle)
gap-scscp 2.1.4%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,624 kB
  • ctags: 7
  • sloc: xml: 1,232; sh: 454; makefile: 21
file content (120 lines) | stat: -rw-r--r-- 4,315 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
###########################################################################
##
#W xstream.gd               The SCSCP package           Alexander Konovalov
#W                                                             Steve Linton
##
###########################################################################


###########################################################################
##
#C  IsInputOutputTCPStream ........... category of input/output TCP streams
##
##  <#GAPDoc Label="IsInputOutputTCPStream">
##  <ManSection>
##  <Filt Name="IsInputOutputTCPStream" />   
##  <Description>
##  <Ref Filt="IsInputOutputTCPStream"/> is a subcategory of
##  <Ref BookName="ref" Filt="IsInputOutputStream"/>. 
##  Streams in the category <Ref Filt="IsInputOutputTCPStream"/> 
##  are created with the help of the function
##  <Ref Func="InputOutputTCPStream" Label="for client" /> with
##  one or two arguments dependently on whether they will be
##  used in the client or server mode. Examples of their creation
##  and usage will be given in subsequent sections.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareCategory( "IsInputOutputTCPStream", IsInputOutputStream );


###########################################################################
##
#R  IsInputOutputTCPStreamRep .. representation of input/output TCP streams
##
##  <#GAPDoc Label="IsInputOutputTCPStreamRep">
##  
##  <ManSection>
##  <Filt Name="IsInputOutputTCPStreamRep" />
##  <Description>
##  This is the representation used for streams in the  
##  category <Ref Filt="IsInputOutputTCPStream"/>.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareRepresentation( "IsInputOutputTCPStreamRep", 
                       IsPositionalObjectRep, [ ] );

InputOutputTCPStreamDefaultType :=
  NewType( StreamsFamily, 
           IsInputOutputTCPStreamRep and IsInputOutputTCPStream);

           
###########################################################################
##
#F  InputOutputTCPStream ............... returns an input/output TCP stream
##
##  <#GAPDoc Label="InputOutputTCPStream">
##  
##  <ManSection>
##  <Func Name="InputOutputTCPStream" Label="for server" Arg="desc" />      
##  <Func Name="InputOutputTCPStream" Label="for client" Arg="host port" />          
##  <Returns>
##     stream   
##  </Returns>	 
##  <Description>
##  The one-argument version must be called from the &SCSCP; server.
##  Its argument <A>desc</A> must be a socket descriptor obtained using
##  <Ref BookName="IO" Func="IO_accept"/> function from the &IO; package
##  (see the example below). It returns a stream in the category 
##  <Ref Filt="IsInputOutputTCPStream"/> which will use this socket to 
##  accept incoming connections. 
##  In most cases, the one-argument version is called automatically 
##  from <Ref Func="RunSCSCPserver"/> rather then manually.    
##  <P/>   
##  The version with two arguments, a string <A>host</A> and an integer
##  <A>port</A>, must be called from the &SCSCP; client. It returns a stream 
##  in the category <Ref Filt="IsInputOutputTCPStream"/> which will be used 
##  by the client for communication with the &SCSCP; server running at 
##  hostname <A>host</A> on port <A>port</A>. 
##  In most cases, the two-argument version is called automatically from
##  the higher level functions, for example, <Ref Func="EvaluateBySCSCP"/>.
##  </Description>
##  </ManSection>           
##  <#/GAPDoc>
##
DeclareGlobalFunction ( "InputOutputTCPStream" );


###########################################################################
##
#F  SCSCPwait
##
##  <#GAPDoc Label="SCSCPwait">
##  
##  <ManSection>
##  <Func Name="SCSCPwait" Arg="stream [timeout]"/>
##  <Returns>
##    nothing
##  </Returns>	 
##  <Description>
##  This function may be used by the &SCSCP; client to wait
##  (using <Ref BookName="IO" Func="IO_select" />)
##  until the result of the procedure call will be 
##  available from <A>stream</A>. By default the timeout is
##  one hour, to specify another value give it as the optional
##  second argument in seconds. See the end of this chapter 
##  for the example.
##  </Description>
##  </ManSection>           
##  <#/GAPDoc>
##
DeclareGlobalFunction ( "SCSCPwait" );


###########################################################################
##
#E 
##