Beispiel #1
0
        /// <summary>
        /// generate xml message and send it to to specified host
        /// </summary>
        /// <param name="ipAddress"></param>
        /// <param name="port"></param>
        public void SendXml(string ipAddress, int port,bool firstLenght=false)
        {
            string xmlData = @"<?xml version='1.0'?>
< doc >
    < assembly >
        < name > xmlsample </ name >
    </ assembly >
    < members >
        < member name = 'T:SomeClass' >
             < summary >
             Class level summary documentation goes here.</ summary >
             < remarks >
             Longer comments can be associated with a type or member
             through the remarks tag </ remarks >
         </ member >
         < member name = 'F:SomeClass.myName' >
              < summary >
              Store for the name property </ summary >
          </ member >
          < member name = 'M:SomeClass.#ctor' >
              < summary > The class constructor.</summary> 
        </member>
        <member name = 'M:SomeClass.SomeMethod(System.String)' >
            < summary >
            Description for SomeMethod.</summary>
            <param name = 's' > Parameter description for s goes here</param>
            <seealso cref = 'T:System.String' >
            You can use the cref attribute on any tag to reference a type or member
            and the compiler will check that the reference exists. </seealso>
        </member>
        <member name = 'M:SomeClass.SomeOtherMethod' >
            < summary >
            Some other method. </summary>
            <returns>
            Return results are described through the returns tag.</returns>
            <seealso cref = 'M:SomeClass.SomeMethod(System.String)' >
            Notice the use of the cref attribute to reference a specific method</seealso>
        </member>
        <member name = 'M:SomeClass.Main(System.String[])' >
            < summary >
            The entry point for the application.
            </summary>
            <param name = 'args' > A list of command line arguments</param>
        </member>
        <member name = 'P:SomeClass.Name' >
            < summary >
            Name property</summary>
            <value>
            A value tag is used to describe the property value</value>
        </member>
    </members>
</doc>";

            byte[] data = Encoding.Unicode.GetBytes(xmlData);
            APSocket.Net.Client client = new APSocket.Net.Client();
            client.Connect(System.Net.IPAddress.Parse(ipAddress), port);
            client.SendAsync(data, firstLenght);
        }
Beispiel #2
0
        /// <summary>
        /// generate iso8583 message and send it to to specified host
        /// </summary>
        /// <param name="ipAddress">Host IPAddress</param>
        /// <param name="port">Host Port</param>
        public void SendIso8583(string ipAddress, int port,bool firstLenght= false)
        {
            MessageParser.NET.Tools.ISO8583 iso = new MessageParser.NET.Tools.ISO8583();
            Random rand = new Random();

            string[] DE = new string[130];

            DE[2] = (rand.Next(0, 9999).ToString() + rand.Next(0, 9999).ToString() + rand.Next(0, 9999).ToString() + rand.Next(0, 99999).ToString()).PadLeft(17, '0');

            DE[3] = (rand.Next(0, 999999).ToString()).PadLeft(6, '0');

            DE[4] = (rand.Next(0, 99999).ToString()).PadLeft(5, '0');

            DE[7] =
                (DateTime.Now.Month.ToString().PadLeft(2, '0')
                + DateTime.Now.Day.ToString().PadLeft(2, '0')
                + DateTime.Now.Hour.ToString().PadLeft(2, '0')
                + DateTime.Now.Minute.ToString().PadLeft(2, '0')
                + DateTime.Now.Second.ToString().PadLeft(2, '0'));

            DE[11] = (rand.Next(0, 999).ToString()).PadLeft(3, '0');

            DE[22] = (rand.Next(0, 99999999).ToString()).PadLeft(8, '0');

            DE[41] = (rand.Next(0, 99).ToString()).PadLeft(2, '0');

            string data = iso.Build(DE, "0200");

            APSocket.Net.Client client = new APSocket.Net.Client();
            client.Connect(System.Net.IPAddress.Parse(ipAddress), port);
            client.SendAsync(Encoding.Unicode.GetBytes(data), firstLenght);
        }