Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 06:59

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Server, Client and socket] unkown problem i can't fix

Discussion on [Server, Client and socket] unkown problem i can't fix within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
[Server, Client and socket] unkown problem i can't fix

in explanation of my problem i have a client and server apps

server send and receive packet as client do ...

the client sends a login request to the server and if server replied with agree

the main form of client shall be hide and appear another form for the user ..

everything is okay ...

but when i send a packet from the server to the client while user is logged on ... the client don't receive it until the user log out and client went back to the main form

but client send packets any time normally and server receive it as well ..

so any solution ?

Server :

PHP Code:
private void Open_Hash_Minutes_Click(object senderEventArgs e)
        {
            if (
SelectedClient.PC_STATE == Data.Enums.ClientState.Reachable || SelectedClient.PC_STATE == Data.Enums.ClientState.Online)
            {
                
Control control = (Control)sender;
                
int Time int.Parse(control.Text);
                
SetTimeForm LF = new SetTimeForm(SelectedClientCalcTime);
                
DialogResult dr LF.ShowDialog(this);
                if (
dr == System.Windows.Forms.DialogResult.Cancel)
                {
                    
LF.Close();
                }
                else if (
dr == System.Windows.Forms.DialogResult.OK)
                {
                    if (
SelectedClient.PC_STATE == Data.Enums.ClientState.Reachable)
                    {
                        
Network.Packets.LoginOrder LO = new Network.Packets.LoginOrder(truetrueLF.ChoosedTimeData.Enums.User.Guest);
                        
LO.Send(SelectedClient);
                    }
                    else if (
SelectedClient.PC_STATE == Data.Enums.ClientState.Online || SelectedClient.PC_STATE == Data.Enums.ClientState.Paused)
                    {
                        
Network.Packets.EditSession EditSession = new Network.Packets.EditSession(truetrueLF.ChoosedTime);
                        
SelectedClient.Send(EditSession);
                    }
                }
            }
            else 
            {
                
MessageBox.Show("This client is not reachable !""HotCafe Server"MessageBoxButtons.OKMessageBoxIcon.Information);
            }
        } 
PHP Code:
        static void AuthServer_AnnounceNewConnection(Interfaces.ISocketWrapper obj)
        {
            
Client.State authState = new Client.State(obj.Socket);
            
obj.Connector authState;
        }
        static 
void AuthServer_AnnounceDisconnection(Interfaces.ISocketWrapper obj)
        {
            if (
obj != null)
            {
                
Client.State client = (Client.State)obj.Connector;
                if (
client != null)
                {
                    
client.Disconnect();
                }
            }
        }
        static 
void AuthServer_AnnounceReceive(byte[] packetInterfaces.ISocketWrapper StO)
        {
            try
            {
                
Client.State client = (Client.State)StO.Connector;
                
client.MF MF;
                
Network.PacketHandler.Handle(packetclient);
            }
            catch (
Exception e)
            {
                
Program.WriteLine(e.ToString());
            }
        } 
Client :

PHP Code:
        public static void Handle(byte[] packetClient.State client)
        {
            if (
packet == null)
                return;
            if (
client == null)
                return;

            
ushort ID BitConverter.ToUInt16(packet0);
            
ushort Length BitConverter.ToUInt16(packet2);

            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(messageclient);
                        break;
                    }
                case 
1005:
                    {
                        
Network.Packets.StartSession StartSession = new Network.Packets.StartSession();
                        
StartSession.Deserialize(packet);
                        
client.Session = new Data.Session(clientStartSession);
                        
client.Session.Start();
                        break;
                    }
                case 
1007:
                    {
                        
Network.Packets.EditSession EditSession = new Network.Packets.EditSession();
                        
EditSession.Deserialize(packet);
                        
client.Session.Edit(EditSession.AddEditSession.Time);
                        break;
                    }
                default:
                    {
                        
client.Send(packet);
                        break;
                    }
            }
        } 
PHP Code:
        public void LogIn(Client.State _client)
        {
            switch (
client.PC_USER)
            {
                case 
Data.Enums.ClientUser.Admin:
                    {
                        
//this.Hide();
                        
OldSize this.Size;
                        
this.Size = new System.Drawing.Size(00);
                        
this.WindowState FormWindowState.Minimized;
                        
HandForm = new HandForm(thisclient);
                        
HandForm.UserForm.AdminControlIsVisible true;
                        
HandForm.UserForm.UpdateStart();
                        
HandForm.ShowDialog(this);
                    }
                    break;
                case 
Data.Enums.ClientUser.Guest:
                    {
                        switch (
client.Session.Limited)
                        {
                            case 
true:
                                {
                                    
//this.Hide();
                                    
OldSize this.Size;
                                    
this.Size = new System.Drawing.Size(00);
                                    
this.WindowState FormWindowState.Minimized;
                                    
HandForm = new HandForm(thisclient);
                                    
HandForm.UserForm.AdminControlIsVisible false;
                                    
HandForm.UserForm.UpdateStart();
                                    
HandForm.ShowDialog(this);
                                    break;
                                }
                            case 
false:
                                {
                                    
//this.Hide();
                                    
OldSize this.Size;
                                    
this.Size = new System.Drawing.Size(00);
                                    
this.WindowState FormWindowState.Minimized;
                                    
HandForm = new HandForm(thisclient);
                                    
HandForm.UserForm.AdminControlIsVisible false;
                                    
HandForm.UserForm.UpdateStart();
                                    
HandForm.ShowDialog(this);
                                    break;
                                }
                        }
                        break;
                    }
            }
        } 
i break pointed handle void in client , but it's don't receive the packet until session is ended
abdeen is offline  
Thanks
1 User
Old 10/20/2014, 19:49   #2
 
elite*gold: 67
Join Date: Aug 2014
Posts: 1,321
Received Thanks: 927


Atleast show us the code.
Xio. is offline  
Old 10/20/2014, 19:55   #3
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
what exactly code you want to check ?

i tried to don't hide the main form and just re size it to (0, 0) and minimize it but still my problem is going up ...
abdeen is offline  
Old 10/20/2014, 20:10   #4
 
elite*gold: 0
Join Date: Jul 2014
Posts: 402
Received Thanks: 540
Best Coder 2014 is offline  
Thanks
3 Users
Old 10/20/2014, 20:19   #5
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
Server :

PHP Code:
private void Open_Hash_Minutes_Click(object senderEventArgs e)
        {
            if (
SelectedClient.PC_STATE == Data.Enums.ClientState.Reachable || SelectedClient.PC_STATE == Data.Enums.ClientState.Online)
            {
                
Control control = (Control)sender;
                
int Time int.Parse(control.Text);
                
SetTimeForm LF = new SetTimeForm(SelectedClientCalcTime);
                
DialogResult dr LF.ShowDialog(this);
                if (
dr == System.Windows.Forms.DialogResult.Cancel)
                {
                    
LF.Close();
                }
                else if (
dr == System.Windows.Forms.DialogResult.OK)
                {
                    if (
SelectedClient.PC_STATE == Data.Enums.ClientState.Reachable)
                    {
                        
Network.Packets.LoginOrder LO = new Network.Packets.LoginOrder(truetrueLF.ChoosedTimeData.Enums.User.Guest);
                        
LO.Send(SelectedClient);
                    }
                    else if (
SelectedClient.PC_STATE == Data.Enums.ClientState.Online || SelectedClient.PC_STATE == Data.Enums.ClientState.Paused)
                    {
                        
Network.Packets.EditSession EditSession = new Network.Packets.EditSession(truetrueLF.ChoosedTime);
                        
SelectedClient.Send(EditSession);
                    }
                }
            }
            else 
            {
                
MessageBox.Show("This client is not reachable !""HotCafe Server"MessageBoxButtons.OKMessageBoxIcon.Information);
            }
        } 
PHP Code:
        static void AuthServer_AnnounceNewConnection(Interfaces.ISocketWrapper obj)
        {
            
Client.State authState = new Client.State(obj.Socket);
            
obj.Connector authState;
        }
        static 
void AuthServer_AnnounceDisconnection(Interfaces.ISocketWrapper obj)
        {
            if (
obj != null)
            {
                
Client.State client = (Client.State)obj.Connector;
                if (
client != null)
                {
                    
client.Disconnect();
                }
            }
        }
        static 
void AuthServer_AnnounceReceive(byte[] packetInterfaces.ISocketWrapper StO)
        {
            try
            {
                
Client.State client = (Client.State)StO.Connector;
                
client.MF MF;
                
Network.PacketHandler.Handle(packetclient);
            }
            catch (
Exception e)
            {
                
Program.WriteLine(e.ToString());
            }
        } 
Client :

PHP Code:
        public static void Handle(byte[] packetClient.State client)
        {
            if (
packet == null)
                return;
            if (
client == null)
                return;

            
ushort ID BitConverter.ToUInt16(packet0);
            
ushort Length BitConverter.ToUInt16(packet2);

            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(messageclient);
                        break;
                    }
                case 
1005:
                    {
                        
Network.Packets.StartSession StartSession = new Network.Packets.StartSession();
                        
StartSession.Deserialize(packet);
                        
client.Session = new Data.Session(clientStartSession);
                        
client.Session.Start();
                        break;
                    }
                case 
1007:
                    {
                        
Network.Packets.EditSession EditSession = new Network.Packets.EditSession();
                        
EditSession.Deserialize(packet);
                        
client.Session.Edit(EditSession.AddEditSession.Time);
                        break;
                    }
                default:
                    {
                        
client.Send(packet);
                        break;
                    }
            }
        } 
PHP Code:
        public void LogIn(Client.State _client)
        {
            switch (
client.PC_USER)
            {
                case 
Data.Enums.ClientUser.Admin:
                    {
                        
//this.Hide();
                        
OldSize this.Size;
                        
this.Size = new System.Drawing.Size(00);
                        
this.WindowState FormWindowState.Minimized;
                        
HandForm = new HandForm(thisclient);
                        
HandForm.UserForm.AdminControlIsVisible true;
                        
HandForm.UserForm.UpdateStart();
                        
HandForm.ShowDialog(this);
                    }
                    break;
                case 
Data.Enums.ClientUser.Guest:
                    {
                        switch (
client.Session.Limited)
                        {
                            case 
true:
                                {
                                    
//this.Hide();
                                    
OldSize this.Size;
                                    
this.Size = new System.Drawing.Size(00);
                                    
this.WindowState FormWindowState.Minimized;
                                    
HandForm = new HandForm(thisclient);
                                    
HandForm.UserForm.AdminControlIsVisible false;
                                    
HandForm.UserForm.UpdateStart();
                                    
HandForm.ShowDialog(this);
                                    break;
                                }
                            case 
false:
                                {
                                    
//this.Hide();
                                    
OldSize this.Size;
                                    
this.Size = new System.Drawing.Size(00);
                                    
this.WindowState FormWindowState.Minimized;
                                    
HandForm = new HandForm(thisclient);
                                    
HandForm.UserForm.AdminControlIsVisible false;
                                    
HandForm.UserForm.UpdateStart();
                                    
HandForm.ShowDialog(this);
                                    break;
                                }
                        }
                        break;
                    }
            }
        } 
i break pointed handle void in client , but it's don't receive the packet until session is ended
abdeen is offline  
Old 10/20/2014, 20:27   #6
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
I would help you if I could read your ******* code.
Super Aids is offline  
Thanks
1 User
Old 10/20/2014, 20:48   #7
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
Quote:
Originally Posted by Super Aids View Post
I would help you if I could read your ******* code.
isn't hard to read my great code lol

just tell me what point you can't get ...
abdeen is offline  
Old 10/20/2014, 21:45   #8
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Quote:
Originally Posted by abdeen View Post
isn't hard to read my great code lol

just tell me what point you can't get ...
it's a useless mess like everything you post here.

Stop, just stop.
pro4never is offline  
Old 10/20/2014, 21:56   #9
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
Quote:
Originally Posted by pro4never View Post
it's a useless mess like everything you post here.

Stop, just stop.
post a solution or Stop , just stop.
abdeen is offline  
Old 10/20/2014, 23:21   #10
 
elite*gold: 67
Join Date: Aug 2014
Posts: 1,321
Received Thanks: 927
He has a point you know? Halloween isnt for another 11 days but your code looks spooky already. Take my candy, just take it and make it stop.
Xio. is offline  
Old 10/20/2014, 23:50   #11
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
I don't understand anything.

What about learning the language and name conventions.
Super Aids is offline  
Old 10/21/2014, 18:52   #12
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239

posting the codes make it worse.
try to organize the codes and more information
and try to breakpoints the handling
abdoumatrix is offline  
Thanks
1 User
Old 10/21/2014, 21:09   #13
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
Quote:
Originally Posted by abdoumatrix View Post

posting the codes make it worse.
try to organize the codes and more information
and try to breakpoints the handling
i am already posted the codes ...

but as i explained the issue it's with forms .. client do no accept packets until i went back to the main form ... and i will put here an code for for explanation ...

abdeen is offline  
Old 10/21/2014, 21:24   #14
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,652
Received Thanks: 701
Enviremont.Exit(0);
turk55 is offline  
Old 10/21/2014, 21:39   #15
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 14
Quote:
Originally Posted by turk55 View Post
Enviremont.Exit(0);
this for quit the app .... did you read my issue ?
abdeen is offline  
Reply


Similar Threads Similar Threads
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...
socket_read() [function.socket-read]: unable to read from socket [0] - Problem
03/10/2012 - Web Development - 0 Replies
Thema gelöst ; )
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



All times are GMT +2. The time now is 06:59.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.