本文整理汇总了C#中ServiceReference1.Service1Client.Open方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceReference1.Service1Client.Open方法的具体用法?C# ServiceReference1.Service1Client.Open怎么用?C# ServiceReference1.Service1Client.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceReference1.Service1Client
的用法示例。
在下文中一共展示了ServiceReference1.Service1Client.Open方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
ServiceReference1.Service1Client SvcProxy = new ServiceReference1.Service1Client("tcpWcfSvcLib1EP");
SvcProxy.Open();
//2,147,483,647
byte[] valuesBytes;
valToTransfer[] mivs = null;
for (int x = 0; x < TEST_COUNT; x++)
{
DateTime startTime = DateTime.Now;
valuesBytes = SvcProxy.GetData();
mivs = HandDeserialize(valuesBytes);
DateTime endTime = DateTime.Now;
TimeSpan ts = new TimeSpan(endTime.Ticks - startTime.Ticks);
aggregateMilliseconds += ts.Milliseconds;
Console.WriteLine("time for call:[" + ts.Milliseconds + "]");
Console.WriteLine("size of data passed [" + valuesBytes.Length + "]");
Console.WriteLine("packet number[" + mivs[0].struct2_data_len + "]"); // hijacked for testing purposes..
Console.WriteLine("500th item audit[" + mivs[499].struct1_ulong1 + "]");
Console.WriteLine("9000th item audit[" + mivs[8999].struct1_ulong1 + "]");
}
Console.WriteLine("avg time per call [" + aggregateMilliseconds/TEST_COUNT + "]");
SvcProxy.Close();
}
示例2: Main
static void Main(string[] args)
{
// client config..
ServiceReference1.Service1Client myClient = new ServiceReference1.Service1Client();
try
{
myClient.Open();
for (int x = 2; x < 12; x++)
{
Console.WriteLine(myClient.GetData(x));
Thread.Sleep(1000);
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Stack Trace======================");
Console.WriteLine(e.StackTrace);
}
myClient.Close();
}
示例3: Main
static void Main(string[] args)
{
ServiceReference1.Service1Client SvcProxy = new ServiceReference1.Service1Client("tcpWcfSvcLib1EP");
SvcProxy.Open();
//2,147,483,647
valToTransfer [] values;
for (int x = 0; x < TEST_COUNT; x++)
{
DateTime startTime = DateTime.Now;
values = SvcProxy.GetData();
DateTime endTime = DateTime.Now;
TimeSpan ts = new TimeSpan(endTime.Ticks - startTime.Ticks);
aggregateMilliseconds += ts.Milliseconds;
Console.WriteLine("time for call:[" + ts.Milliseconds + "]");
Console.WriteLine("size of data passed [" + values.Length + "]");
}
Console.WriteLine("avg time per call [" + aggregateMilliseconds/TEST_COUNT + "]");
SvcProxy.Close();
}
示例4: Main
static void Main(string[] args)
{
ServiceReference1.Service1Client SvcProxy = new ServiceReference1.Service1Client("tcpWcfSvcLib1EP");
SvcProxy.Open();
//2,147,483,647
MonitoredItemValue [] values;
#if BIN_SERIALIZE_TEST
byte[] valuesBytes;
#endif
for (int x = 0; x < TEST_COUNT; x++)
{
DateTime startTime = DateTime.Now;
#if BIN_SERIALIZE_TEST
valuesBytes = SvcProxy.GetData();
// BinaryFormatter bf = new BinaryFormatter();
// MonitoredItemValue []miv_ary = bf.Deserialize(
#else
values = SvcProxy.GetData();
#endif
DateTime endTime = DateTime.Now;
TimeSpan ts = new TimeSpan(endTime.Ticks - startTime.Ticks);
aggregateMilliseconds += ts.Milliseconds;
Console.WriteLine("time for call:[" + ts.Milliseconds + "]");
#if BIN_SERIALIZE_TEST
Console.WriteLine("size of data passed [" + valuesBytes.Length + "]");
#else
Console.WriteLine("size of data passed [" + values.Length + "]");
Console.WriteLine("first val [" + values[0] + "]");
#endif
}
Console.WriteLine("avg time per call [" + aggregateMilliseconds/TEST_COUNT + "]");
SvcProxy.Close();
}