Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Whats Wrong With this Vb2008 Code? (Not That Much code)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Eldia
How do I cheat?
Reputation: 0

Joined: 28 Jan 2010
Posts: 5

PostPosted: Fri Jan 29, 2010 11:46 pm    Post subject: Whats Wrong With this Vb2008 Code? (Not That Much code) Reply with quote

I am Making a Chat Clien and Server in VB2008 I am using Winsock. My Problem the Server will listen and The Client will connect but when I sent a Message The Other one Does not receive it? There Are No errors just a Green line under the Words There are Two one in Server code and One in client they say=incommingData
Server code:
Code:
Option Strict Off
Option Explicit On
Friend Class frmchat
   Inherits System.Windows.Forms.Form
   
   Private Sub cmdListen_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdListen.Click
        Winsock.LocalPort = 3000 'open the port on the local machine try to use ports between 3000 and 50000
      Winsock.Listen() ' start listening, simple!
   End Sub
   
   
   
   Private Sub Winsock_ConnectionRequest(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles Winsock.ConnectionRequest
      Winsock.Close() 'this resets our socket ready to accept the incoming connection
      Winsock.Accept(eventArgs.requestID) 'accept the connection!
   End Sub
   
   Private Sub winsock_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles winsock.DataArrival
      
      Dim incommingData As String 'this stores the data we receive
      
      Winsock.GetData([color=red]incommingData[/color]) ' this stores the data in the variable we set above
      
      ' now we will display it in the textbox
      
      txtWindow.Text = txtWindow.Text & vbNewLine & incommingData
      txtWindow.SelectionStart = Len(txtWindow.Text) 'this just positions the text box to focus on the newest piece of information!
   End Sub
   
   Private Sub cmdSend_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSend.Click
      Winsock.SendData(txtchatBox.Text) ' sends the data in the textbox
      
      txtWindow.Text = txtWindow.Text & vbNewLine & txtchatBox.Text 'displays data
      txtWindow.SelectionStart = Len(txtWindow.Text) ' this just positions the text box to focus on the newest piece of information!
      txtchatBox.Text = "" ' just empties the text box
      
   End Sub
End Class




Client Code:
Code:
Option Strict Off
Option Explicit On
Friend Class frmChat
   Inherits System.Windows.Forms.Form
   
   Private Sub cmdConnect_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdConnect.Click
      Winsock.RemoteHost = "127.0.0.1" ' this is the Ip of the server 127.0.0.1 loops back to your own computer
        Winsock.RemotePort = 3000 ' this is the port it must be the same as the server
      Winsock.Connect() ' connect!
   End Sub
   
   
   
   Private Sub cmdSend_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSend.Click
      Winsock.SendData(txtchatBox.Text) ' sends the data in the textbox
        MsgBox("Messege Sent")
      txtWindow.Text = txtWindow.Text & vbNewLine & txtchatBox.Text 'displays data
      txtWindow.SelectionStart = Len(txtWindow.Text) ' this just positions the text box to focus on the newest piece of information!
      txtchatBox.Text = "" ' just empties the text box
      
   End Sub
   
   
   
   Private Sub winsock_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles winsock.DataArrival
      
      Dim incommingData As String 'this stores the data we receive
      
      Winsock.GetData([color=red]incommingData[/color]) ' this stores the data in the variable we set above
      
      ' now we will display it in the textbox
      
      txtWindow.Text = txtWindow.Text & vbNewLine & incommingData
      txtWindow.SelectionStart = Len(txtWindow.Text) 'this just positions the text box to focus on the newest piece of information!
   End Sub
   
   Private Sub winsock_connectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles winsock.connectEvent
      MsgBox("We are connected")
   End Sub
End Class

Thank Your for your time!
Back to top
View user's profile Send private message
pedropmp
Cheater
Reputation: 0

Joined: 17 Jan 2010
Posts: 27

PostPosted: Mon Feb 01, 2010 5:52 pm    Post subject: Reply with quote

remove the
Code:
[color=red] and [/color]


SERVER CODE

Code:

Option Strict Off
Option Explicit On
Friend Class frmchat
   Inherits System.Windows.Forms.Form
   
   Private Sub cmdListen_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdListen.Click
        Winsock.LocalPort = 3000 'open the port on the local machine try to use ports between 3000 and 50000
      Winsock.Listen() ' start listening, simple!
   End Sub
   
   
   
   Private Sub Winsock_ConnectionRequest(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles Winsock.ConnectionRequest
      Winsock.Close() 'this resets our socket ready to accept the incoming connection
      Winsock.Accept(eventArgs.requestID) 'accept the connection!
   End Sub
   
   Private Sub winsock_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles winsock.DataArrival
     
      Dim incommingData As String 'this stores the data we receive
     
      Winsock.GetData(incommingData) ' this stores the data in the variable we set above
     
      ' now we will display it in the textbox
     
      txtWindow.Text = txtWindow.Text & vbNewLine & incommingData
      txtWindow.SelectionStart = Len(txtWindow.Text) 'this just positions the text box to focus on the newest piece of information!
   End Sub
   
   Private Sub cmdSend_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSend.Click
      Winsock.SendData(txtchatBox.Text) ' sends the data in the textbox
     
      txtWindow.Text = txtWindow.Text & vbNewLine & txtchatBox.Text 'displays data
      txtWindow.SelectionStart = Len(txtWindow.Text) ' this just positions the text box to focus on the newest piece of information!
      txtchatBox.Text = "" ' just empties the text box
     
   End Sub
End Class


CLIENT CODE

Code:

Option Strict Off
Option Explicit On
Friend Class frmChat
   Inherits System.Windows.Forms.Form
   
   Private Sub cmdConnect_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdConnect.Click
      Winsock.RemoteHost = "127.0.0.1" ' this is the Ip of the server 127.0.0.1 loops back to your own computer
        Winsock.RemotePort = 3000 ' this is the port it must be the same as the server
      Winsock.Connect() ' connect!
   End Sub
   
   
   
   Private Sub cmdSend_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSend.Click
      Winsock.SendData(txtchatBox.Text) ' sends the data in the textbox
        MsgBox("Messege Sent")
      txtWindow.Text = txtWindow.Text & vbNewLine & txtchatBox.Text 'displays data
      txtWindow.SelectionStart = Len(txtWindow.Text) ' this just positions the text box to focus on the newest piece of information!
      txtchatBox.Text = "" ' just empties the text box
     
   End Sub
   
   
   
   Private Sub winsock_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles winsock.DataArrival
     
      Dim incommingData As String 'this stores the data we receive
     
      Winsock.GetData(incommingData) ' this stores the data in the variable we set above
     
      ' now we will display it in the textbox
     
      txtWindow.Text = txtWindow.Text & vbNewLine & incommingData
      txtWindow.SelectionStart = Len(txtWindow.Text) 'this just positions the text box to focus on the newest piece of information!
   End Sub
   
   Private Sub winsock_connectEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles winsock.connectEvent
      MsgBox("We are connected")
   End Sub
End Class
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites