Prepare fixtures
This commit is contained in:
parent
797e5ea192
commit
9c94356263
6021 changed files with 722805 additions and 22 deletions
14
kf_sources/NetworkTest/Classes/NetworkTest.uc
Normal file
14
kf_sources/NetworkTest/Classes/NetworkTest.uc
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class NetworkTest extends Mutator
|
||||
config(TestMut);
|
||||
|
||||
function PostBeginPlay()
|
||||
{
|
||||
local TestTcp tcp;
|
||||
tcp = Spawn(class'TestTcp');
|
||||
tcp.Initialize();
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
bAlwaysRelevant = true
|
||||
}
|
||||
9
kf_sources/NetworkTest/Classes/TestObj.uc
Normal file
9
kf_sources/NetworkTest/Classes/TestObj.uc
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class TestObj extends Object
|
||||
perobjectconfig
|
||||
config(test);
|
||||
|
||||
var config string value;
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
117
kf_sources/NetworkTest/Classes/TestTcp.uc
Normal file
117
kf_sources/NetworkTest/Classes/TestTcp.uc
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
class TestTcp extends TcpLink;
|
||||
|
||||
var bool cooldown;
|
||||
var array<byte> tttt;
|
||||
var TestObj g1, g2, g3, g4;
|
||||
|
||||
public function Initialize()
|
||||
{
|
||||
linkMode = MODE_Binary;
|
||||
receiveMode = RMODE_Manual;
|
||||
SetTimer(5.0, true);
|
||||
Log("[TestTcp] Binding port...");
|
||||
if (BindPort(1234) > 0) {
|
||||
Log("Success!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Failed! So much for the `TcpLink` :(");
|
||||
return;
|
||||
}
|
||||
Log("[TestTcp] Putting socket in listen mode...");
|
||||
if (Listen()) {
|
||||
Log("Success!");
|
||||
}
|
||||
else {
|
||||
Log("Failed right at th finish line! So much for the `TcpLink` :(");
|
||||
}
|
||||
}
|
||||
/*
|
||||
event Timer()
|
||||
{
|
||||
if (linkState == STATE_Initialized) {
|
||||
Log("[TestTcp] STATUS:" @ "Sockets is initialized");
|
||||
}
|
||||
else if (linkState == STATE_Ready) {
|
||||
Log("[TestTcp] STATUS:" @ "Port bound, ready for activity");
|
||||
}
|
||||
else if (linkState == STATE_Listening) {
|
||||
Log("[TestTcp] STATUS:" @ "Listening for connections");
|
||||
}
|
||||
else if (linkState == STATE_Connecting) {
|
||||
Log("[TestTcp] STATUS:" @ "Attempting to connect");
|
||||
}
|
||||
else if (linkState == STATE_Connected) {
|
||||
Log("[TestTcp] STATUS:" @ "Open and connected");
|
||||
}
|
||||
else if (linkState == STATE_ListenClosePending) {
|
||||
Log("[TestTcp] STATUS:" @ "Socket in process of closing");
|
||||
}
|
||||
else if (linkState == STATE_ConnectClosePending) {
|
||||
Log("[TestTcp] STATUS:" @ "Socket in process of closing");
|
||||
}
|
||||
else if (linkState == STATE_ListenClosing) {
|
||||
Log("[TestTcp] STATUS:" @ "Socket in process of closing");
|
||||
}
|
||||
else if (linkState == STATE_ConnectClosing) {
|
||||
Log("[TestTcp] STATUS:" @ "Socket in process of closing #2");
|
||||
}
|
||||
}
|
||||
*/
|
||||
event Tick(float delta)
|
||||
{
|
||||
local TestObj o1, o2, o3, o4;
|
||||
local int i, dataRead, totalRead, iter;
|
||||
local byte data[255];
|
||||
local string message;
|
||||
if (cooldown)
|
||||
{
|
||||
cooldown = false;
|
||||
return;
|
||||
}
|
||||
if (!IsDataPending()) {
|
||||
return;
|
||||
}
|
||||
dataRead = ReadBinary(255, data);
|
||||
while (dataRead > 0)
|
||||
{
|
||||
iter += 1;
|
||||
totalRead += dataRead;
|
||||
//Log("{" $ dataRead $ "}");
|
||||
for (i = 0; i < dataRead; i += 1) {
|
||||
//message $= Chr(data[i]);
|
||||
tttt[tttt.length] = data[i];
|
||||
}
|
||||
if (iter > 100) break;
|
||||
if (dataRead == 255)
|
||||
{
|
||||
dataRead = ReadBinary(255, data);
|
||||
//Log("!{" $ dataRead $ "}!");
|
||||
}
|
||||
else {
|
||||
cooldown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
StopWatch(false);
|
||||
for (i = 0; i < 10000; i += 1) {
|
||||
g1 = new(none, string(i)) class'TestObj';
|
||||
}
|
||||
StopWatch(true);
|
||||
Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
Log("Test run:" @ g1.value);
|
||||
}
|
||||
|
||||
event Accepted()
|
||||
{
|
||||
Log("[TestTcp] Accepted!");
|
||||
}
|
||||
|
||||
event Closed()
|
||||
{
|
||||
Log("[TestTcp] Closed!");
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
}
|
||||
9
kf_sources/NetworkTest/Classes/index.html
Normal file
9
kf_sources/NetworkTest/Classes/index.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head><title>Index of /kf_sources/NetworkTest/Classes/</title></head>
|
||||
<body>
|
||||
<h1>Index of /kf_sources/NetworkTest/Classes/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="NetworkTest.uc">NetworkTest.uc</a> 23-Apr-2021 10:00 225
|
||||
<a href="TestObj.uc">TestObj.uc</a> 23-Apr-2021 12:42 123
|
||||
<a href="TestTcp.uc">TestTcp.uc</a> 13-Jul-2021 16:52 2989
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue