the issue is when i send a packet to the client when the session is started the client dont receive it till the session is end and when i break pointed the coming packet in the client i kept press F10 till the last line and its give me this screen ...
the issue is when i send a packet to the client when the session is started the client dont receive it till the session is end and when i break pointed the coming packet in the client i kept press F10 till the last line and its give me this screen ...
You know, sometimes you need to step into, not step over. Like when you see a **** lying down, in order to check it out, step into it, don't step over it, or you might miss to see that that's a real ****.
You know, sometimes you need to step into, not step over. Like when you see a **** lying down, in order to check it out, step into it, don't step over it, or you might miss to see that that's a real ****.
You know, sometimes you need to step into, not step over. Like when you see a **** lying down, in order to check it out, step into it, don't step over it, or you might miss to see that that's a real ****.
It's funny, because it's pretty much how debugging works.
HandForm = new HandForm(this, client);
HandForm.UserForm.AdminControlIsVisible = false;
HandForm.UserForm.UpdateStart();
HandForm.ShowDialog(this);
it's a part of this
PHP Code:
case Data.Enums.ClientUser.Guest:
{
switch (client.Session.Limited)
{
case true:
{
this.Hide();
HandForm = new HandForm(this, client);
HandForm.UserForm.AdminControlIsVisible = false;
HandForm.UserForm.UpdateStart();
HandForm.ShowDialog(this);
break;
}
case false:
{
this.Hide();
HandForm = new HandForm(this, client);
HandForm.UserForm.AdminControlIsVisible = false;
HandForm.UserForm.UpdateStart();
HandForm.ShowDialog(this);
break;
}
}
break;
}
and i kept on trying Un-comment the lines on by one till the last one when i tried it i got the problem is here when i show the handform
PHP Code:
HandForm.ShowDialog(this);
Client Socket :
PHP Code:
public class AsyncSocket
{
public Socket Connection, HashSocket;
public event Action<AsyncSocketWrapper> OnClientConnect;
public event Action<AsyncSocketWrapper> OnClientDisconnect;
public event Action<byte[], AsyncSocketWrapper> OnClientReceive;
public AsyncSocket()
{
Connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
HashSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
public bool Connect(string IP, int Port)
{
IPAddress ipAddress = IPAddress.Parse(IP);
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, Port);
while (!Connection.Connected)
{
try
{
HashSocket.Connect(ipEndPoint);
if (HashSocket.Connected)
{
Connection.BeginConnect(ipEndPoint, new AsyncCallback(AsyncConnect), null);
System.Threading.Thread.Sleep(2000);
if (Connection.Connected)
{
return true;
}
}
}
catch
{
System.Threading.Thread.Sleep(2000);
}
}
return false;
}
private void AsyncConnect(IAsyncResult res)
{
try
{
AsyncSocketWrapper sender = null;
sender = new AsyncSocketWrapper();
sender.BufferSize = 8000;
sender.Socket = this.Connection;
sender.Buffer = new byte[sender.BufferSize];
this.Connection.EndConnect(res);
if (this.OnClientConnect != null)
{
this.OnClientConnect(sender);
}
sender.Socket.BeginReceive(sender.Buffer, 0, sender.Buffer.Length, SocketFlags.None, new AsyncCallback(this.AsyncReceive), sender);
}
catch (Exception ex)
{
Program.WriteLine(ex);
}
}
private void OnSend(IAsyncResult res)
{
try
{
Connection.EndSend(res);
byte[] byteData = new byte[1024];
Connection.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(AsyncReceive), null);
}
catch (Exception ex)
{
Program.WriteLine(ex);
}
}
private void AsyncReceive(IAsyncResult res)
{
bool was = false;
try
{
SocketError error;
AsyncSocketWrapper asyncState = (AsyncSocketWrapper)res.AsyncState;
int RecvSize = asyncState.Socket.EndReceive(res, out error);
if ((error == SocketError.Success) && (RecvSize > 0))
{
was = true;
byte[] buffer = new byte[RecvSize];
for (int i = 0; i < RecvSize; i++)
{
buffer[i] = asyncState.Buffer[i];
}
if (this.OnClientReceive != null)
{
this.OnClientReceive(buffer, asyncState);
}
public static void Handle(byte[] packet, Client.State client)
{
if (packet == null)
return;
if (client == null)
return;
ushort ID = BitConverter.ToUInt16(packet, 0);
ushort Length = BitConverter.ToUInt16(packet, 2);
switch (ID)
{
case 1003:
{
Message message = new Message();
message.Deserialize(packet);
if (message.MESSAGE_CONTENT.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries).Length > 0)
message.MESSAGE_CONTENT = message.MESSAGE_CONTENT.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries)[0];
Chat(message, client);
break;
}
case 1005:
{
Network.Packets.StartSession StartSession = new Network.Packets.StartSession();
StartSession.Deserialize(packet);
client.Session = new Data.Session(client, StartSession);
client.Session.Start();
break;
}
case 1007:
{
Network.Packets.EditSession EditSession = new Network.Packets.EditSession();
EditSession.Deserialize(packet);
client.Session.Edit(EditSession.Add, EditSession.Time);
break;
}
default:
{
client.Send(packet);
break;
}
}
}
PHP Code:
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
}
public Client.State client;
public HandForm HandForm;
#region Session Handle
public void LogIn(Client.State _client)
{
switch (client.PC_USER)
{
case Data.Enums.ClientUser.Admin:
{
this.Hide();
HandForm = new HandForm(this, client);
HandForm.UserForm.AdminControlIsVisible = true;
HandForm.UserForm.UpdateStart();
HandForm.ShowDialog(this);
}
break;
case Data.Enums.ClientUser.Guest:
{
switch (client.Session.Limited)
{
case true:
{
this.Hide();
HandForm = new HandForm(this, client);
HandForm.UserForm.AdminControlIsVisible = false;
HandForm.UserForm.UpdateStart();
HandForm.ShowDialog(this);
break;
}
case false:
{
this.Hide();
HandForm = new HandForm(this, client);
HandForm.UserForm.AdminControlIsVisible = false;
HandForm.UserForm.UpdateStart();
HandForm.ShowDialog(this);
break;
}
}
break;
}
}
}
public void Pause(Client.State _client)
{
this.LoginTimer.Stop();
this.Show();
this.HandForm.Close();
}
public void Resume(Client.State _client)
{
}
public void LogOut(Client.State _client)
{
this.LoginTimer.Stop();
this.Show();
this.HandForm.Close();
}
#endregion
}
PHP Code:
public partial class HandForm : Form
{
public UserForm UserForm;
public MainForm MainForm;
public Client.State client;
bool Opened = false;
SlidingController slider = null;
public HandForm(MainForm mainForm, Client.State client)
{
InitializeComponent();
this.MainForm = mainForm;
this.client = client;
UserForm = new UserForm(mainForm, client);
slider = new SlidingController(UserForm, this);
}
private void Logout_Key_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure that you want to end the session ?", "HotCafe", MessageBoxButtons.YesNo, MessageBoxIcon.Question ) == System.Windows.Forms.DialogResult.Yes)
{
client.Session.End();
}
}
}
}
i got it i can receive the packets even if i hided the main form but it's not receiving packet when i show the hand form ...
and i can receive all packets which are sent by server when the session is ended and hand form is closed ...
public static class PacketHandler
{
public static void Handle(byte[] packet, Client.State client)
{
if (packet == null)
return;
if (client == null)
return;
ushort ID = BitConverter.ToUInt16(packet, 0);
ushort Length = BitConverter.ToUInt16(packet, 2);
switch (ID)
{
case 1003:
{
Message message = new Message();
message.Deserialize(packet);
if (message.MESSAGE_CONTENT.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries).Length > 0)
message.MESSAGE_CONTENT = message.MESSAGE_CONTENT.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries)[0];
Chat(message, client);
break;
}
case 1005:
{
Network.Packets.StartSession StartSession = new Network.Packets.StartSession();
StartSession.Deserialize(packet);
client.Session = new Data.Session(client, StartSession);
client.Session.Start();
break;
}
case 1007:
{
Network.Packets.EditSession EditSession = new Network.Packets.EditSession();
EditSession.Deserialize(packet);
client.Session.Edit(EditSession.Add, EditSession.Time);
break;
}
default:
{
client.Send(packet);
break;
}
}
}
private static void Chat(Message message, Client.State client)
{
switch (message.MESSAGE_TYPE)
{
case Data.Enums.ChatType.System:
{
string M = message.MESSAGE_CONTENT.Replace("\0", "").Split('\0')[0];
switch (M)
{
case "ADMIN_LOGIN_NO":
{
client.MF.UpdateSystemMessage("Invalid Username or Password!!");
break;
}
case "LOGIN_REQUEST_REJECTED":
{
client.MF.UpdateSystemMessage("Login request has been rejected!!");
break;
}
}
break;
}
case Data.Enums.ChatType.Whisper:
{
break;
}
}
}
Client check if server socket is open C# 10/21/2014 - CO2 Programming - 5 Replies i want the client check if the server socket is online or not , and if it's not it's wait 20 sec then check again .. i tried to figure it out by making this code but still doesn't make what i want ... i think there is a good solution better than the one i made .
public bool Connect(string IP, int Port)
{
int tries = 0;
IPAddress ipAddress = IPAddress.Parse(IP);
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, Port);
while...
Editing Conquer Server Socket [ creating new client ] 04/21/2014 - CO2 Private Server - 11 Replies Hello Epvp members , as title say i am editing conquer server socket to make it conquer client socket , actually i tried it many times but fails , spent more time on that , well ,, here is my idea..
Server and client each one have 2 sockets... Login Socket , Game Socket
Server socket working very well , but i need to edit it to work with the client , just receiving and sending data , bytes and packets.. and don`t listen for incoming connections ... as i said i spent long time on this i...
VPC problem - can´t connect to local mySQL server trough socket 07/29/2011 - Metin2 Private Server - 26 Replies hallo leute wollte mir einen mt2 pserver erstellen hat auch alles geklappt...
metin ist auch gelaufen....
nur mein windows hat ein bisschen gesponnen..
also habe ich es mit service pack 1 auf einer andern festplatte neu aufgesetzt..
dann wollte ich mit vpc wieder einen pserver erstellen
erstellt dann im vpc nach dem login (hab natürlich alles konfiguriert)
wollte ich wie gewoht ./start eingeben aber dann kam folgendes:
http://img713.imageshack.us/img713/4706/startfehl erm.jpg
Steelseries Merc Stelth Problem ( Unkown Device ) 03/01/2010 - Technical Support - 4 Replies Hi leute,
meine wundertolle Freundin hat mir das tolle MERC Stealth von Steelseries gekauft.
Leider erkennt mein laptop es weder als Tastatur noch als sonst irgendwas, es wird immer nur "unknown Device" angezeigt. Habs bei ihr aufm Laptop auch probiert, genau das selbe. Alle Treiber und Bios sind geupdated (inklusive chipsätze).
Der Laptop den ich benutz ist ein Acer Aspire 7738G mit Win7 64 bit
Ich hoff ihr könnt mir helfen :)
Grüße