|
You last visited: Today at 08:47
Advertisement
Null help.
Discussion on Null help. within the CO2 Programming forum part of the Conquer Online 2 category.
12/24/2010, 12:41
|
#1
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Null help.
Alright, i don't know why i had my last thread closed, I guess I thought I could handle is.
I have been at this problem literally all day and have tried 4 different socket wrappers and they all have the same issue.
PHP Code:
Console.WriteLine("Incoming Auth Data");
AuthClient sender = Sender.Wrapper as AuthClient;
sender.AuthServer.Send(Data);
This is currently Hybrids socket that were upgraded for 5018+
sender is ALWAYS null so when i try to send the data it throws the null exception. My question is is how come it is null and won't 'define' as a AuthClient. If it helps this is my AuthClient class
PHP Code:
public class AuthClient
{
public string Username, Server, Name, Spouse, GameIp;
public uint UID;
public Socket ClientSock;
public WinsockClient AuthServer;
public LoginEncryption.AuthProtocolCryptographer ClientAuth;
public LoginEncryption.AuthProtocolCryptographer ServerAuth;
public byte[] Buffer;
public void Disconnect()
{
try
{
Console.WriteLine("Disconnect()");
this.Buffer = null;
this.ClientSock.Disconnect(true);
this.AuthServer.Disconnect();
//remove from LoginConnection
}
catch { }
}
public AuthClient(Socket C, ushort Port)
{
ClientSock = C;
try
{
ClientAuth = new LoginEncryption.AuthProtocolCryptographer();
ServerAuth = new LoginEncryption.AuthProtocolCryptographer();
Buffer = new byte[1024];
AuthServer = new WinsockClient(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
AuthServer.Enable(Program.ServerIP, Port, this.Buffer);
AuthServer.OnReceive += new SocketEventCallback<WinsockClient, byte[]>(AuthServer_OnReceive);
AuthServer.OnDisconnect += new SocketEventCallback<WinsockClient, object>(AuthServer_OnDisconnect);
}
catch
{
Console.WriteLine("Failed to connect to auth server!");
try
{
//remove from LoginConnections
this.ClientSock.Disconnect(false);
this.ClientSock.Dispose();
}
catch { }
}
}
void AuthServer_OnDisconnect(WinsockClient Sender, object Arg)
{
Disconnect();
}
void AuthServer_OnReceive(WinsockClient Sender, byte[] Arg)
{
Console.WriteLine("Auth Server Packet recvieved");
try { AuthHandler.HandleServerPacket(Arg, this); }
catch { }
}
}
If you could help that would be wonderful.
Thanks
|
|
|
12/24/2010, 13:18
|
#2
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
I think this is happening because you're not setting the Wrapper member in WinsockClient to the AuthClient instance.
Code:
AuthServer.Wrapper = this
However it is irrelevant, why are you using the Sender.Wrapper instead of directly using 'this' keyword? You're essentially in a member function of the same class.
|
|
|
12/24/2010, 16:26
|
#3
|
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
|
If sender is null that means that Wrapper can`t be casted to AuthClient. Check why they`re not compatible in your code.
|
|
|
12/24/2010, 17:38
|
#4
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
To clear up what they are saying some... go to where you have your on connect method and set the wrapper to the instance of the auth client object you create...
IE on connect you'd be doing something like...
Sender.Wraper = new AuthClient(Socket, Port);
that way the wrapper is not null and you can therefor use it when receiving packets from that client.
|
|
|
12/24/2010, 22:55
|
#5
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
I do set it to an instance if the auth client
Sender.Wrapper = new AuthClient(Sender); Within the AuthConnect.
Edit:
Here is my connections class
PHP Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using OpenSSL; using System.Net; using System.Net.Sockets; using Network; namespace Conquer_Proxy.Connections { class Connections { public static void Connect() { ConquerSocket AuthS = new ConquerSocket(); AuthS.Port = Program.ProxyPort; AuthS.ClientBufferSize = 100; AuthS.Backlog = 10; AuthS.OnClientDisconnect = new SocketEvent<HybridWinsockClient, object>(AuthDisconnect); AuthS.OnClientReceive = new SocketEvent<HybridWinsockClient, byte[]>(AuthReceive); AuthS.OnClientConnect = new SocketEvent<HybridWinsockClient, object>(AuthConnect); AuthS.Enable();
ConquerSocket GameS = new ConquerSocket(); GameS.Port = 5000; GameS.ClientBufferSize = 1000; GameS.Backlog = 10; GameS.OnClientDisconnect = new SocketEvent<HybridWinsockClient, object>(GameDisconnect); GameS.OnClientReceive = new SocketEvent<HybridWinsockClient, byte[]>(GameReceive); GameS.OnClientConnect = new SocketEvent<HybridWinsockClient, object>(GameConnect); GameS.Enable();
/*ServerSocket Auth = new ServerSocket(); Auth.Listen(5001); Auth.OnClientDisconnect += new SocketErrorEvent(Auth_OnClientDisconnect); Auth.OnReceivePacket += new SocketEvent(Auth_OnReceivePacket); Auth.OnClientConnect += new SocketEvent(Auth_OnClientConnect);
ServerSocket Game = new ServerSocket(); Game.Listen(5000); Game.OnClientDisconnect += new SocketErrorEvent(Game_OnClientDisconnect); Game.OnReceivePacket += new SocketEvent(Game_OnReceivePacket); Game.OnClientConnect += new SocketEvent(Game_OnClientConnect);*/ } public static void AuthConnect(HybridWinsockClient Sender, object param) {//First try { Console.WriteLine("Accepting New Auth Connection"); //remove from LoginConnections Sender.Wrapper = new AuthClient(Sender); //add to LoginConnections } catch (Exception e) { Console.WriteLine(e.ToString()); } } public static void AuthReceive(HybridWinsockClient Sender, byte[] param) {//Second try { byte[] Data = param; Console.WriteLine("Incoming Auth Data"); AuthClient sender = Sender.Wrapper as AuthClient; Console.WriteLine("Length: " + Data.Length + " Data: \r\n" + Dump(Data)); sender.AuthServer.Send(Data); } catch (Exception e) { Console.WriteLine(e.ToString()); } } public static void AuthDisconnect(HybridWinsockClient Sender, object param) { try { Console.WriteLine("Auth Disconnected"); ((AuthClient)param).Disconnect(); } catch (Exception e) { Console.WriteLine(e.ToString()); } } public static void GameConnect(HybridWinsockClient Sender, object param) {//third try { Console.WriteLine("Accepting New Game Connection"); //ifconnected client contains socket- disconnect param = new Client(Sender.Connection, Program.ServerGamePort); //add connected client } catch { } } public static void GameReceive(HybridWinsockClient Sender, byte[] param) {//forth try { byte[] Data = param; Console.WriteLine("Accepting Game Data"); Client C = Sender.Wrapper as Client; C.ServerCrypto.Decrypt(Data); if (C.Exchanging && Data.Length > 36) { C.ClientDHPacket = new Encryption.ClientDHPacket(Data); C.ClientDHPacket.Edit(Data, C.ClientCrypto.DH.PublicKey.ToHexString()); C.ToServerQueue.Enqueue(Data); SetUpCrypt(C); } else { /*split client packet*/ } } catch { } } public static void GameDisconnect(HybridWinsockClient Sender, object param) { Console.WriteLine("Game Disconnected"); Client C = Sender.Wrapper as Client; //disconnect } public static object Dump(byte[] Bytes) { string Hex = ""; foreach (byte b in Bytes) { Hex = Hex + b.ToString("X2") + " "; } string Out = ""; while (Hex.Length != 0) { int SubLength = 0; if (Hex.Length >= 48) { SubLength = 48; } else { SubLength = Hex.Length; } string SubString = Hex.Substring(0, SubLength); int Remove = SubString.Length; SubString = SubString.PadRight(60, ' '); Hex = Hex.Remove(0, Remove); Out = Out + SubString + "\r\n"; } return Out; } static void SetUpCrypt(Client C) { try { BigNumber RealClientPublicKey = BigNumber.FromHexString(C.ClientDHPacket.Client_PubKey); BigNumber RealServerPublicKey = BigNumber.FromHexString(C.ServerDHPacket.Server_PubKey);
Encryption.GameEncryption ClientCrypt = new Encryption.GameEncryption(ASCIIEncoding.ASCII.GetString((C.ClientCrypto).DH.ComputeKey(RealServerPublicKey))); Encryption.GameEncryption ServerCrypt = new Encryption.GameEncryption(ASCIIEncoding.ASCII.GetString((C.ServerCrypto).DH.ComputeKey(RealClientPublicKey)));
ClientCrypt.Blowfish.EncryptIV = C.ServerDHPacket.ClientIV; ClientCrypt.Blowfish.DecryptIV = C.ServerDHPacket.ServerIV;
ServerCrypt.Blowfish.EncryptIV = C.ServerDHPacket.ServerIV; ServerCrypt.Blowfish.DecryptIV = C.ServerDHPacket.ClientIV;
C.ClientCrypto = ClientCrypt; C.ServerCrypto = ServerCrypt; C.Exchanging = false; } catch (Exception e) { Console.WriteLine(e.ToString()); } }
} }
|
|
|
12/26/2010, 13:37
|
#6
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
That's strange PM me your MSN or something, I wouldn't mind helping you debug it.
|
|
|
 |
Similar Threads
|
SpielModus (Null) ?
09/11/2010 - WarRock - 18 Replies
Watafak? :awesome:
http://i55.tinypic.com/2eye73m.jpg
|
null kal 1hithack?
08/16/2010 - Kal Online - 11 Replies
naja da sind'n paar leute mit 1hithack o.o
weiß einer wie das da geht?
der macht 2 mio dmg beim boss xd...
|
NULL NULL
11/01/2008 - Kal Online - 1 Replies
Hallo zusammen ,
Ich habe mir nach dieser anleitung Server erstellen - KalZone.de - Deutscher KalOnline P-Server Support
einen kalserver gebaut .
Aber wen ich in das spiel möchte ... zeigt er mir den fehler NULL NULL an i einem kleinem fenster.
|
Null-Config für 1.9.3?
02/09/2007 - Ragnarok Online - 6 Replies
Ich wollte mal ein paar einfache Makros laufen lassen im xkore wie etwa Phenswitch. ich fand null-configs für 1.9.0 bzw 1.9.1 aber darüber hinaus nichtmehr. Mit der Suchfunktion hier bzw im openkore forum direkt kam ich auch nicht weiter. mit den älteren versionen ist es ja nicht möglich auf euro zu botten. Muss ich komplett die ganze Config ändern oder hat da vielleicht schon wer einen link? Hoffe ihr könnt mir da helfen.
|
All times are GMT +1. The time now is 08:48.
|
|