unable to send packets

08/26/2012 11:52 evolution007#1
hello. i use srProxy to send packets to my client but when i use srproxy i cant launch client. i get this error:
[Only registered and activated users can see links. Click Here To Register...]
settings for loader. redirect ip : 127.0.0.1:15779
i thought maybe if i modify the source of my code i will be able to not use srproxy but i was wrong. source code:
Code:
using System;
using System.Collections;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace SendNotice
{
    class Program
    {
        class ConnectedSocket
        {
            private Socket winSock;

            public void Connect(string IP, int Port)
            {
                winSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                IPAddress IPA = IPAddress.Parse(IP);
                IPEndPoint IPEP = new IPEndPoint(IPA, Port);
                try
                {
                    winSock.Connect(IPEP);
                }
                catch (SocketException se)
                {
                    Console.WriteLine(se.Message);
                }
            }

            public void Send(byte[] data)
            {
                if (winSock.Connected)
                    winSock.Send(data);
            }
        }

        private static ConnectedSocket Socket = new ConnectedSocket();

        static void Main(string[] args)
        {
            Socket.Connect("127.0.0.1", 9000);

            while (true)
            {
                Console.Write("Notice: ");
                string message = Console.ReadLine();
                Console.WriteLine("");
                SendNotice(message);
            }
        }

        private static void SendNotice(string notice)
        {
            PacketWriter writer = new PacketWriter(0x3026, 1); // OpCode 0x3026, Security (2 -> to server, 1 -> to client) for SrProxy
            writer.AppendByte(7); //Chat type
            writer.AppendUnicodeString(notice); //Message
            Socket.Send(writer.GetPacket());
        }
    }

    class PacketWriter
    {
        private ArrayList Data;
        private ArrayList Packet;
        private int Size;

        public PacketWriter(ushort opcode, byte security)
        {
            Size = 0;
            Data = new ArrayList();
            Packet = new ArrayList();

            Data.AddRange(BitConverter.GetBytes(opcode));
            Data.Add((byte)security);
            Data.Add((byte)0);
        }

        public byte[] GetPacket()
        {
            Packet.AddRange(BitConverter.GetBytes((ushort)Size));
            Packet.AddRange(Data);
            return (byte[])Packet.ToArray(typeof(byte));
        }

        public void AppendByte(byte value)
        {
            Data.Add((byte)value);
            Size += 1;
        }

        public void AppendUnicodeString(string message)
        {
            AppendWord((ushort)message.Length);
            Data.AddRange(Encoding.Unicode.GetBytes(message));
            Size += message.Length * 2;
        }

        public void AppendWord(ushort value)
        {
            Data.AddRange(BitConverter.GetBytes(value));
            Size += 2;
        }
    }
}
any ideas how to use it as simple as possible. i tried to use SilkroadSecurityApi but it looks for me too difficult
08/26/2012 15:06 GoneUp#2
It has nothing to do with your Program. The sro_client just cannot connect to your proxy. Did you started it for sure?
08/27/2012 11:09 evolution007#3
my loader port was wrong.
09/14/2012 10:19 worldgs#4
u open sro_client for olly