SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 115 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

Created
&& serverSocket == Socket.Listening);
}
[Action]
public static void ClientConnect()
{
clientSocket = Socket.Connecting;
}
public static bool ClientSendEnabled()
{
return (clientSocket == Socket.Connected
&& phase == Phase.Send);
}
// No parameter needed here, client always sends the same thing
[Action]
public static void ClientSend()
{
phase = Phase.ServerReceive;
}
// continued ....
Figure 5.10. Remote instrument client/server: model program (part 4).
80 Model Programs
// ... continued
public static bool ClientReceiveEnabled()
{
return (clientSocket == Socket.Connected
&& phase == Phase.ClientReceive);
}
// Return value needed here, server sends different values
[Action]
public static double ClientReceive()
{
double t = clientBuffer;
clientBuffer = EmptyBuffer;
phase = Phase.Send;
return t;
}
public static bool ClientCloseEnabled()
{
return (clientSocket == Socket.Created
|| clientSocket == Socket.Connected);
}
[Action] public static void ClientClose()
{
clientSocket = Socket.Closed;
}
}
}
Figure 5.11. Remote instrument client/server: model program (part 5).
all the action method names must be different (you cannot use the class names to
distinguish them).
The Socket type enumerates the values of the two control state variables server-
Socket and clientSocket. They represent the steps in the protocol shown in Chapter
2, Figure 2.


Pages:
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6