Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Go Back  Xtreme Visual Basic Talk > > > Multiple forms and multiple Winsocks question...


Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2004, 08:12 PM
MicroMan MicroMan is offline
Newcomer
 
Join Date: Jan 2004
Posts: 6
Default Multiple forms and multiple Winsocks question...


I'm trying to write a client that uses multiple forms. In effect, it is a hybrid client/server that allows for interapplication communication without the use of a central server.

However, I'm having trouble getting to grips with how I should approach this, and what sort of design pattern one could use, or if there's any examples.

This is what I want to do:

1) Have a server socket that listens.
2) Have a command parsing socket that receives a connection from the server socket
3) Depending on the command analysis of the parsing socket this socket should open one of three different kinds of forms.
4) The parsing socket should establish itself as the data transfer socket for the opened form.

This is a .Net aircode snippet that I've written to sort of understand the problem, but I'm writing this app in VB 6 because I must use Winsock and because the one I'm writing it form doesn't want to install the .Net framework.

Code:
Public Sub Listener_ConnectionRequest()
  If Listener.State = SocketStates.sckCOnnected then
    dim temp as integer = socketArray(socketArray.GetUpperBound(0)+1)
    ReDim socketArray(temp)
    Socket(temp).Accept(requestID)
  End If
End Sub

Public Sub Socket_DataArrival()
  Dim strDat as String
  If Socket.State = SocketStates.SckConnected then
    Socket.Getdata(strDat,vbString)
    ParseData(strDat)
  End If
End Sub

Private Sub ParseData(strDat as Sting)
  Dim cmd as String
  cmd = Microsoft.Visualbasic.Left(strDat,4)
  Select case cmd
    Case "chat"
      chat = new frmChat
      chat.Socket = Socket
      chat.Show()
    Case "file"
      fil = new frmFiles
      fil.Socket = Socket
      fil.Show()
    Case mesg"
  End Select
End Sub
VB6 just won't let me assign the socket as I do in the above code. And of course, it reports an error already in the IDE when I try to Set it.

Anyone with any ideas?

I'd appreciate it.

Cheers,
Microman
Reply With Quote
  #2  
Old 01-25-2004, 10:16 PM
jumentous's Avatar
jumentous jumentous is offline
Contributor
 
Join Date: Sep 2003
Location: Australia
Posts: 612
Default

I have dont no .NEt so far but in VB6 Redim can only be used in dynamic arrays not control arrays, to load the next form you can do
Code:
Load Socket(socket.ubound + 1) socket(socket.ubound).accept requestid
__________________
"In The Land of The Blind the One-Eyed Man is King."

Jumentous
Reply With Quote
  #3  
Old 01-26-2004, 08:17 AM
MicroMan MicroMan is offline
Newcomer
 
Join Date: Jan 2004
Posts: 6
Default

Quote:
Originally Posted by jumentous
I have dont no .NEt so far but in VB6 Redim can only be used in dynamic arrays not control arrays, to load the next form you can do
Code:
Load Socket(socket.ubound + 1) socket(socket.ubound).accept requestid



Hmm, okay, didn't know that. SocketArray is just an dynamic array of object, not a control array. But the main problem still remains. When the code gets to ParseData and tries to shunt the open datareceiving socket (as descibed in point 4) to the new form, nothing happens...
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying multiple forms tony873004 General 1 10-20-2003 08:21 PM
Need Help Linking forms from multiple projects greedy_fly0 General 4 05-30-2003 09:14 AM
PrintForm, Multiple Forms johnbt81 General 6 04-15-2003 02:24 PM
more multiple forms DonLduk General 4 12-11-2002 09:08 PM
Displaying a VB app on the web (multiple forms, etc???) mfw5978 General 1 09-05-2002 02:37 PM

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
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question... Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
 
Multiple forms and multiple Winsocks question...
Multiple forms and multiple Winsocks question...
 
-->