diff --git a/ironfleet/README.md b/ironfleet/README.md index 22579ffe..5280575d 100755 --- a/ironfleet/README.md +++ b/ironfleet/README.md @@ -179,7 +179,7 @@ console: dotnet src/IronSHTServer/bin/Release/net5.0/IronSHTServer.dll localhost:4001 localhost:4002 localhost:4003 localhost:4001 dotnet src/IronSHTServer/bin/Release/net5.0/IronSHTServer.dll localhost:4001 localhost:4002 localhost:4003 localhost:4002 dotnet src/IronSHTServer/bin/Release/net5.0/IronSHTServer.dll localhost:4001 localhost:4002 localhost:4003 localhost:4003 - dotnet src/IronSHTClient/bin/Release/net5.0/IronSHTClient.dll nthreads=10 duration=30 workload=g numkeys=10000 client=localhost:6000 verbose=true + dotnet src/IronSHTClient/bin/Release/net5.0/IronSHTClient.dll nthreads=10 duration=30 workload=g numkeys=10000 clientport=6000 verbose=true ``` The client will print its output to standard output. If you use @@ -228,7 +228,7 @@ where you fill out the ellipses to provide: Your client implementation, like in `src/IronRSLKVClient/Client.cs`, will create a connection to the replicated service with: ``` - RSLClient rslClient = new RSLClient(serverEndpoints, myClientEndpoint); + RSLClient rslClient = new RSLClient(serverEndpoints, myPortNumber); ``` and submit requests to that replicated service with: ``` diff --git a/ironfleet/src/IronRSLClient/IronRSLClient.csproj b/ironfleet/src/IronRSLClient/IronRSLClient.csproj new file mode 100755 index 00000000..a39c8a27 --- /dev/null +++ b/ironfleet/src/IronRSLClient/IronRSLClient.csproj @@ -0,0 +1,18 @@ + + + + net5.0 + IronRSLClient + 1.0.2 + Jay Lorch and Chris Hawblitzel + Microsoft Corporation + true + MIT + + + + + + + + diff --git a/ironfleet/src/IronRSLClient/IronRSLClient.sln b/ironfleet/src/IronRSLClient/IronRSLClient.sln new file mode 100755 index 00000000..a75370ef --- /dev/null +++ b/ironfleet/src/IronRSLClient/IronRSLClient.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31321.278 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRSLClient", "IronRSLClient.csproj", "{0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AFC77FFD-EE03-4482-A506-7F4B3A3B4431} + EndGlobalSection +EndGlobal diff --git a/ironfleet/src/IronfleetCommon/RSLClient.cs b/ironfleet/src/IronRSLClient/RSLClient.cs similarity index 95% rename from ironfleet/src/IronfleetCommon/RSLClient.cs rename to ironfleet/src/IronRSLClient/RSLClient.cs index f02b31e2..7753cba0 100755 --- a/ironfleet/src/IronfleetCommon/RSLClient.cs +++ b/ironfleet/src/IronRSLClient/RSLClient.cs @@ -5,20 +5,21 @@ using System.Linq; using System.Net; -namespace IronfleetCommon +namespace IronRSLClient { - class RSLClient + public class RSLClient { IPEndPoint[] serverEps; - IPEndPoint myEp; + int myPort; IoScheduler scheduler; UInt64 nextSeqNum; int primaryServerIndex; - public RSLClient(IEnumerable i_serverEps, IPEndPoint i_myEp) + public RSLClient(IEnumerable i_serverEps, int i_myPort) { serverEps = Enumerable.ToArray(i_serverEps); - myEp = i_myEp; + myPort = i_myPort; + var myEp = new IPEndPoint(IPAddress.Any, myPort); scheduler = new IoScheduler(myEp, true, false); // onlyClient = true, verbose = false primaryServerIndex = 0; Start(); diff --git a/ironfleet/src/IronRSLCounterClient/Client.cs b/ironfleet/src/IronRSLCounterClient/Client.cs index 95784b0f..670f304e 100755 --- a/ironfleet/src/IronRSLCounterClient/Client.cs +++ b/ironfleet/src/IronRSLCounterClient/Client.cs @@ -1,5 +1,6 @@ using IronfleetCommon; using IronfleetIoFramework; +using IronRSLClient; using System; using System.Collections.Generic; using System.IO; @@ -66,8 +67,7 @@ static public IEnumerable StartThreads(Params ps) private void Run() { - IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), ps.clientPort + (int)id); - RSLClient rslClient = new RSLClient(ps.serverEps, myEndpoint); + RSLClient rslClient = new RSLClient(ps.serverEps, ps.clientPort + (int)id); Thread.Sleep(3000); diff --git a/ironfleet/src/IronRSLCounterClient/IronRSLCounterClient.csproj b/ironfleet/src/IronRSLCounterClient/IronRSLCounterClient.csproj index 7614475f..2bc74948 100755 --- a/ironfleet/src/IronRSLCounterClient/IronRSLCounterClient.csproj +++ b/ironfleet/src/IronRSLCounterClient/IronRSLCounterClient.csproj @@ -6,10 +6,8 @@ - - - + diff --git a/ironfleet/src/IronRSLKVClient/Client.cs b/ironfleet/src/IronRSLKVClient/Client.cs index 15d2627b..641372bf 100755 --- a/ironfleet/src/IronRSLKVClient/Client.cs +++ b/ironfleet/src/IronRSLKVClient/Client.cs @@ -1,4 +1,5 @@ using IronfleetCommon; +using IronRSLClient; using IronfleetIoFramework; using KVMessages; using System; @@ -74,8 +75,7 @@ private static KVRequest GetRandomRequest(Random rng, Params ps) private void Run() { - IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), ps.clientPort + (int)id); - RSLClient rslClient = new RSLClient(ps.serverEps, myEndpoint); + RSLClient rslClient = new RSLClient(ps.serverEps, ps.clientPort + (int)id); Thread.Sleep(3000); diff --git a/ironfleet/src/IronRSLKVClient/IronRSLKVClient.csproj b/ironfleet/src/IronRSLKVClient/IronRSLKVClient.csproj index 072d8fa0..0668de65 100755 --- a/ironfleet/src/IronRSLKVClient/IronRSLKVClient.csproj +++ b/ironfleet/src/IronRSLKVClient/IronRSLKVClient.csproj @@ -6,11 +6,9 @@ - - - - + + diff --git a/ironfleet/src/IronSHTClient/Client.cs b/ironfleet/src/IronSHTClient/Client.cs index a41a4803..ea3b3420 100755 --- a/ironfleet/src/IronSHTClient/Client.cs +++ b/ironfleet/src/IronSHTClient/Client.cs @@ -295,7 +295,7 @@ public string ByteArrayToString(byte[] ba) public void Setup() { - IPEndPoint myEndpoint = new IPEndPoint(ps.clientEp.Address, ps.clientEp.Port + (int)id); + IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Any, ps.clientPort + (int)id); scheduler = new IoScheduler(myEndpoint, false /* only client */, false /* verbose */); ulong myaddr = EncodeIpPort(myEndpoint); @@ -424,7 +424,7 @@ public void Experiment() ulong requestKey = 150; int serverIdx = 0; - IPEndPoint myEndpoint = new IPEndPoint(ps.clientEp.Address, ps.clientEp.Port + ps.numSetupThreads + (int)id); + IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Any, ps.clientPort + ps.numSetupThreads + (int)id); scheduler = new IoScheduler(myEndpoint, false /* only client */, false /* verbose */); ulong myaddr = EncodeIpPort(myEndpoint); ulong seqNum = 0; diff --git a/ironfleet/src/IronSHTClient/Params.cs b/ironfleet/src/IronSHTClient/Params.cs index a511cd9f..f773881e 100755 --- a/ironfleet/src/IronSHTClient/Params.cs +++ b/ironfleet/src/IronSHTClient/Params.cs @@ -9,7 +9,7 @@ public class Params public int numSetupThreads; public int numThreads; public ulong experimentDuration; - public IPEndPoint clientEp; + public int clientPort; public IPEndPoint[] serverEps; public ulong initialSeqNum; public double setFraction; @@ -28,7 +28,7 @@ public Params() serverEps = new IPEndPoint[3] { IPEndPoint.Parse("127.0.0.1:4001"), IPEndPoint.Parse("127.0.0.1:4002"), IPEndPoint.Parse("127.0.0.1:4003") }; - clientEp = IPEndPoint.Parse("127.0.0.1:6000"); + clientPort = 6000; initialSeqNum = 0; workload = 's'; numKeys = 1000; @@ -52,8 +52,8 @@ private bool SetValue(string key, string value) { try { switch (key) { - case "client" : - clientEp = IronfleetCommon.Networking.ResolveIPEndpoint(value); + case "clientport" : + clientPort = Convert.ToInt32(value); return true; case "server1" : diff --git a/ironfleet/src/IronfleetCommon/Networking.cs b/ironfleet/src/IronfleetCommon/Networking.cs index e84dcedb..7f4aced4 100755 --- a/ironfleet/src/IronfleetCommon/Networking.cs +++ b/ironfleet/src/IronfleetCommon/Networking.cs @@ -4,7 +4,7 @@ namespace IronfleetCommon { - class Networking + public class Networking { public static IPEndPoint ResolveIPEndpoint(string s) {