Register for your free account! | Forgot your password?

Go Back   elitepvpers > Conquer Online 2 > CO2 Main - Discussions / Questions > CO2 Programming
You last visited: Today at 22:16

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


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

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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,314
Received Thanks: 920


Atleast show us the code.


Xio. is offline  
Old 10/20/2014, 19:55   #3
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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: 534


Best Coder 2014 is offline  
Thanks
3 Users
Old 10/20/2014, 20:19   #5
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,615
Received Thanks: 833
I would help you if I could read your ******* code.
Super Aids is offline  
Thanks
1 User
Old 10/20/2014, 20:48   #7
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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,310
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
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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,314
Received Thanks: 920
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
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,615
Received Thanks: 833
I don't understand anything.

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

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
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,502
Received Thanks: 573
Enviremont.Exit(0);
turk55 is offline  
Old 10/21/2014, 21:39   #15
 
elite*gold: 0
Join Date: Mar 2010
Posts: 474
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



« Client check if server socket is open C# | Botting era is over? »

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...
Editing Conquer Server Socket [ creating new client ]
04/21/2014 - CO2 PServer - Discussions / Questions - 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......
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 PServer - Discussions / Questions - 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...
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...



All times are GMT +2. The time now is 22:16.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.