winsock control again
winsock control again
winsock control again
winsock control again
winsock control again
winsock control again winsock control again winsock control again winsock control again winsock control again winsock control again winsock control again winsock control again
winsock control again winsock control again
winsock control again
Go Back  Xtreme Visual Basic Talk > > > winsock control again


Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2001, 05:37 PM
davecarr2000
Guest
 
Posts: n/a
Exclamation winsock control again


Can someone look at this code.

This is my Chat Server.

Private Sub Form_Load()
intMax = 0
sckServer(0).LocalPort = 10000
sckServer(0).Listen
End Sub

Private Sub sckServer_ConnectionRequest _
(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load sckServer(intMax)
sckServer(intMax).LocalPort = 10000
sckServer(intMax).Accept requestID
End If
End Sub
Private Sub tcpServer_DataArrival _
(ByVal bytesTotal As Long)

' Declare a variable for the incoming data.
' Invoke the GetData method and set the Text
' property of a TextBox named txtOutput to
' the data.
Dim strData As String
For y = 1 To intMax
sckServer(y).GetData strData
TextReceive.Text = strData
test2.Caption = strData
Next y
End Sub

Private Sub TextSend_Change()
' The TextBox control named txtSendData
' contains the data to be sent. Whenever the user
' types into the textbox, the string is sent
' using the SendData method.
For x = 1 To intMax
sckServer(x).SendData TextSend.Text
test.Caption = intMax
Next x
End Sub

This is my chat client

Private Sub Exit_Click()
End
End Sub

Private Sub Form_Load()
tcpClient.RemoteHost = "192.168.0.55" 'use this when testing done 'IPAdd'
tcpClient.RemotePort = 10000
tcpClient.Connect
End Sub



Private Sub TextSend_Change()
tcpClient.SendData TextSend.Text
End Sub

Private Sub tcpClient_DataArrival _
(ByVal bytesTotal As Long)
Dim strData2 As String
tcpClient.GetData strData2
TextReceive.Text = strData2
End Sub

for some reason, the client cant send text to the server, or the server wont receive text.
but i can send from the server to the client.

Reply With Quote
  #2  
Old 09-05-2001, 06:18 PM
davecarr2000
Guest
 
Posts: n/a
Default Re: winsock control again

if you look at the server section

Private Sub tcpServer_DataArrival _
(ByVal bytesTotal As Long)

youll notice it says tcpserver, this was pasted in from an earlier program.
i have changed this to sckServer (the name given to my winsock control) but i get the error "Procedure declaration doesn't match description of event or procedure having the same name" . If I rename it to anything else, the program runs, but doesn't receive data.
As you can see the winsock is using an index, for multiple connections. could this have something to do with it?

dave thanks in advance.

Reply With Quote
  #3  
Old 09-05-2001, 06:31 PM
orufet's Avatar
orufet orufet is offline
Paranoid Coder

Retired Leader
 
Join Date: Mar 2001
Location: Canada
Posts: 2,716
Default Re: winsock control again

Correct me if I'm wrong, but....

Remember that this is not 100% YOUR chat program. You didn't write all of this. Microsoft did. This code came in MSDN, so I don't think it would be a wise choice to distribute this program and claim it's yours. The idea of MSDN is to provide you with code so that you can see how a control works, and what commands you can use.

Now, I'm sorry if this sounded a little mean, as it wasn't supposed to. Just remember to try to write your own code. I know you wrote some of that, but to me, it looks as if it was based on the MS version....Again, sorry if this sounded mean, as maybe I'm wrong about that, it's just a guess.

Jacob Sheehy
Reply With Quote
  #4  
Old 09-05-2001, 06:43 PM
davecarr2000
Guest
 
Posts: n/a
Default Re: winsock control again

i have no intentions of distributing this, I am just learning to use it. If I did I wouldn't charge for it anyway. There are better chat programs out there like MSN, this could run on my server, for my local network. (I wont need to rely on an Internet connection).

I used a combination of inbuilt help and books online (if that is msdn?)
but they weren't clear (or helpful) enough about the code used, thats why im stuck.

Reply With Quote
  #5  
Old 09-05-2001, 06:50 PM
orufet's Avatar
orufet orufet is offline
Paranoid Coder

Retired Leader
 
Join Date: Mar 2001
Location: Canada
Posts: 2,716
Default Re: winsock control again

When you open VB and click Help, that's MSDN.....

Ok, thanks for clearing up your intentions, what you are doing is just fine.

One site that I have found useful is http://www.vbip.com....

Jacob Sheehy<P ID="edit"><FONT class="small"><EM>Edited by orufet on 09/05/01 08:04 PM.</EM></FONT></P>
Reply With Quote
  #6  
Old 09-05-2001, 07:04 PM
davecarr2000
Guest
 
Posts: n/a
Default Re: winsock control again

thanks, I actually worked out the problem myself, which is always the best way, but it only works once i posted a question?

Now to get multiuser capability.

P. S. I Play cs online, can i distribute this prog to my clan members, free of course, or would i be resricted to own use?

dave.

"The Lights on, but nobody's Home"

Reply With Quote
  #7  
Old 09-05-2001, 07:06 PM
lmb2001
Guest
 
Posts: n/a
Default Re: winsock control again

Multiuser is going to be way more difficlut and can become very frustrationg (or so I have heard....)
You play CS???cool I play TFC....Whats CS like????I just got "Opposing Force" and "Blue Shift"...

?¿-=The Bomb=-¿?
"You all stare, but you'll never see; theres something inside me!"<P ID="edit"><FONT class="small"><EM>Edited by lmb2001 on 09/05/01 08:08 PM.</EM></FONT></P>
Reply With Quote
  #8  
Old 09-05-2001, 07:18 PM
davecarr2000
Guest
 
Posts: n/a
Default Re: winsock control again

if you look at the code i posted, it has index as integer on the server side, and not on the client side.
even though its only server/client at the moment, it is working as if it is server and client no 1.

cs is cool, I tried TFC, but I didn't like it, there is more strategy to CS i think.
I Play in a clan called [TBN] we are on clanbase

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
winsock control again
winsock control again
winsock control again winsock control again
winsock control again
winsock control again
winsock control again winsock control again winsock control again winsock control again winsock control again winsock control again winsock control again
winsock control again
winsock control again
 
winsock control again
winsock control again
 
-->