Visual Basic TCPControl Help - I've Searched, Looked and Learn But not exactly getting it right - Please Help
Simple Card Game - that works
Now want to give it Multiplayer Functinality
Also I am confused, how do I get the client to get information sent from my server to it, since it is not listening (and store it into a string)
I really just want a bare bones code to
have A Master Server that Can recieve Multiple Connections
That Master Server Needs to be able to get messages from each user connected to it
The Master Server Needs to be able to send Messages to each user connected to it
each user (client) needs to be able to recieve and show messages recieved from the master server!
That really sums it up - I need to stream line the network code. I need to focus on the actual card game itself!
Please Help!!!!
1 - Player will start their game (client)
2 - The client will connect to the server
3 - Master Server Accepts the Connect
4 - The Client will automatically send their login info as a string to the Master Server
5 - Master Server Will check the string and get user info - if the Info is correct then the Master Server will send a message to the Client as a string letting it know it is connected
6 - Master Server Will give that player a UniqueID
7 - Master Server Will put Player in a list as An Available Player
8 -
9 - Now
10 -
11 - Player 2 will start their game (client)
12 - The client will connect to the server
13 - Master Server Accepts the Connect
14 - The Client will automatically send their login info as a string to the Master Server
15 - Master Server Will check the string and get user info - if the Info is correct then the Master Server will send a message to the Client as a string letting it know it is connected
16 - Master Server Will give that player a UniqueID
17 - Master Server Will put Player2 in a list as An Available Player
18 -
19 - Now since there are 2 players
20 -
21 - The 2 players are removed from the Available Player List
22 -
23 - Master Server will randomly pick a player 1 to go first
24 - Master Server Sends Message to Player to take turn (as a string code)
25 - Player 1 plays a card - the card info is sent as a string to the master server
26 - The Master Server then sends the Player 1 info to Player 2
27 - Player 2 Client gets the info from the master server that contains the card info from player 1
28 - Player 2 plays their card and the information is sent to the master Server
29 -
30 - Until
31 -
32 - One of the players is considered a winner
33 - At that Time the Server will Record Player 1 as winner or loser and Player 2 as winner or looser
34 - Now The 2 Players are put back onto the available players list
Now this is where I am stuck.
Step 11 -
How do I get my progam to accept more than one person?
So my problem is my TCPControl I guess SO code below
ClientTCPControl.vb (Class)
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text.RegularExpressions
Public Class ClientTCPControl
Public Client As TcpClient
Public DataStream As StreamWriter
Public Sub New(Host As String, Port As Integer)
'Client
Client = New TcpClient(Host, Port)
DataStream = New StreamWriter(Client.GetStream)
End Sub
Public Sub Send(Data As String)
DataStream.Write(Data & vbCrLf)
DataStream.Flush()
End Sub
End Class
MasterSercerTCPControl.vb
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text.RegularExpressions
Public Class MasterServerTCPControl
Public Event MessageReceived(sender As MasterServerTCPControl, Data As String)
Public PublicServerIP As IPAddress = IPAddress.Parse("10.0.0.6")
Public ServerPort As Integer = 64554
Public Server As TcpListener
Private ComThread As Thread
Public IsListening As Boolean = True
'CLIENTS
Private Client As TcpClient
Private ClientData As StreamReader
Public Sub New()
Server = New TcpListener(PublicServerIP, ServerPort)
Server.Start()
ComThread = New Thread(New ThreadStart(AddressOf Listening))
ComThread.Start()
End Sub
Private Sub Listening()
'Create Listener Loop
Do Until IsListening = False
'Accept Incoming Connections
If Server.Pending = True Then
Client = Server.AcceptTcpClient
ClientData = New StreamReader(Client.GetStream)
End If
'Raise event for incoming messages
Try
RaiseEvent MessageReceived(Me, ClientData.ReadLine)
Catch ex As Exception
End Try
'Reduce CPU Usage
Thread.Sleep(100)
Loop
End Sub
End Class
Client Code This Sub Runs when the Player Clicks the Connect Button
Private Sub cmdConnect_Click(sender As Object, e As EventArgs) Handles cmdConnect.Click
'Make Connection to Master Server
Client = New ClientTCPControl("10.0.0.6", 64555)
If Client.Client.Connected Then cmdConnect.Text = "Connected"
varConnectedToServer = True
'Create Login Credential String
LoginCredentials = "login" & "," & varUserName & "," & varUserEMail & "," & varUserPassword & "," & varUserState & "," & varUserMachineIP
& "," & varUserInternetIP & "," & varPlayerPort & ","
SendLoginCredentialsMessage()
End Sub
Also I am confused, how do I get the client to get information sent from my server to it, since it is not listening (and store it into a string)
I really just want a bare bones code to
have A Master Server that Can recieve Multiple Connections
That Master Server Needs to be able to get messages from each user connected to it
The Master Server Needs to be able to send Messages to each user connected to it
each user (client) needs to be able to recieve and show messages recieved from the master server!
That really sums it up - I need to stream line the network code. I need to focus on the actual card game itself!
Please Help!!!!
I suggest you search the net until you find something that sounds like it may be able to do what you want to do.
Like this link from CodeProject
C# \ VB .NET Multi-user Communication Library (TCP).
Although for the server to work I suppose it will need to be on a machine which has a public internet IP address or perhaps port forwarding would need to be used or dynamic dns. Things which may cost extra or not be available from your ISP.
What you need to know about the Internet
Making your Computer Accessible from the Public Internet
La vida loca
Similar Messages
-
2 people sent e-mails to me today and I did not receive them. They both were replies to my e-mail (both different). I am running 10.7.5. I searched everywhere and nothing. Not on iCloud either. This happened a few years ago and never noticed it again. I received emails before and after the 2 that never showed up so can't figure out why I didn't get them! Does Apple automatically delete some emails based on text? These were nothing crazy. One was about decorating cookies for a party and which colors to use! HELP! Now I am worried I am missing important emails!
Greetings Val Val,
Welcome to the Apple Support Communities!
I understand that you are not receiving some email from an account that you have set up on your Mac. To begin the troubleshooting process, I would recommend reading over and working through the attached article.
OS X Mail: Troubleshooting sending and receiving email messages - Apple Support
Have a great day,
Joe -
If time machine puts all of my photos onto my external hard drive using time machine, can I then delete the photos from my computer but view them again from the external hard drive? Basically, can I free up space on my mac but not lose years of photos?
To add to Niel's comment bear in mind that if you have a backup copy on an external HD and later delete the orignals on your Mac HD you will then only have one copy - so no backup.
If the pictures are precious you should have at least two copies, and ideally another copy kept off site, -
In 3.6.16, the buttons are all over the place. In previous versions, the forward, back, refresh, stop and home buttons were all together. In this version, the refresh and stop buttons are between the address and search windows, and the home button to the far right.
I would love to have them all together as they used to be - much more user friendly that way. I have tried installing alternate themes, but the coding of this version over-rides the themes.Firefox 4.0 has a combined Reload and Stop and Go button that appears at the right end of the location bar.
To restore the Firefox 3 appearance you can use these steps:
* Open the "View > Toolbars > Customize" window to move the Stop and Reload button out of the location bar.
* Move the Reload and Stop buttons to their previous position at the left side of the location bar.
* Set the order to "Reload - Stop" to get a combined "Reload/Stop" button.
* Set the order to "Stop - Reload" or separate them otherwise to get two distinct buttons. -
I installed CS6 on my new retina MacBook pro laptops. InDesign and Acrobat display document pixilated. I ran the updates and it fixed Illustrator and Photosho, but not InDesign and Acrobat. What can I do to make them display in high resolution? HELP!
InDesign CS6 is not optimized for retina displays. You’ll need to move to Creative Cloud for retina compatibility.
-
I have cables hooked to my MacBook and HGTV, but can't get tv to display. Help!
I have cables hooked to my MacBook and HGTV, but can't get tv to display. Help!
Are you using a Mini DisplayPort or a Mini-DVI adapter on your MacBook? What input are you using on the TV, VGA, DVI, Composite, Component or HDMI?
Also it would help to know which one of the 21 different models of MacBook you have. To see which model you have go to the Apple in the upper left corner and select About This Mac, then click on More Info. When System Profiler comes up check the Model Identifier.
And the make and model of your TV. -
i'm setting up my new ipad air and it's asking for id and password, but not accepting it. help me
If it is asking for an APlle ID password for an ID you do not recognize then you have stumbled upon the Activation Lock feature of IOS7.
Read more about it here:
http://support.apple.com/kb/HT5818 -
I am using i phone 3GS and just upgraded it to ios 6 and it is not reading my sim..please help!!!!
It's maybe because your iphone was jailbroken or hacked?
-
Whenever I open itunes in my ipad a message comes "cannot connect to iTunes Store"...help to get it right please, I have the new I pad and I was able to connect to iTunes before,and I use 3 g network..there is no network problem for sure because I could use safari and App Store perfectly...
Make sure cellular data is turned on..I checked and it was on
Tap Settings > General > Cellular
Switch Enable 3G to off then back on.
Same for Wi Fi. Tap Settings > Wi-Fi. Switch off then back on.'
Then restart the device.
edited by: cs -
I was filling a form online, then I got to where I had to upload a Microsoft document but when I clicked on upload document I only had the option of uploading photos and videos, but not Microsoft doc. Please help.... How do I upload Microsoft doc and other related office documents?
tis true
I know, I always do that but I was in a rush to get somewhere and I was relying on my thousand dollar Mac to do some kind of recovery or something. I know Microsoft always keeps temporary files (I think Mac does too, part of me asking here in this forum was for someone to tell me where I can find those files) and when you go to open Office Works then it gives you the option of opening the last recent documents, saved or not saved.
I usually copy paste into my emial just in case something goes wrong with the created document but I just didn't have the time to login and do all that My loss, you live and you learn, BUT still if ANYONE got any info on this, PLEASE DO CHIME IN *keeping the hope alive* -
PC crashed. CD-Rom not working. Downloaded CS5 Web Premium but not able to install. Please Help. Help.
I had problem with my CD-rom, it not able to open. On top of that recently my PC crashed.
I managed to install other software, but not able to install CS5 Web Premium.
Ive downloaded the electronic version via Adobe Downloads, but not able install it. -
Hello
ello my little brother has developed lock my iPhone and I could not see the unlocking code Please help and thank you
edited by hostHi Omar_a983,
If you are having an issue with the passcode on your iPhone, you may find the following article helpful:
iOS: Forgotten passcode or device disabled after entering wrong passcode
http://support.apple.com/kb/ht1212
Regards,
- Brenden -
I can't open my itunes store. I can open my music library and sync but not open my music store. I have deleted and reinstalled ituens and still not good. Help
I assume you are talking about iTunes on your computer, if so, you will have to remove all Apple programs associated with iTunes:
iTunes, QuickTime, Apple Software Update, Apple Mobile Device Support, Bonjour and Apple Application Support (iTunes 9 or later)
Make sure everything that is by Apple is removed including Safari. You can sort by "Publisher", when you uninstall programs. Make sure you have at least one other web browser (like Firefox or Internet Explorer) before removing Safari. That way you can go back to the Apple web site and redownload iTunes later.
Reboot the computer then reinstall iTunes. Everything should work normally. -
My new Apple password works on my computer and ipad but not my 4s. help!
I had to reset my apple password because apple store wouldn't let me use my original one for some reason.
Now I have a new password and it's working on my computer and ipad, but not my 4s, so if I needed an app, I'd have to get it from ipad and it'd sync to my phone.
I've tried turning my phone on/off, sync with and without wire, called for help (they want $35), nothing works so far. Please help!thank you for the quick reply. I've done that I believe but will do so right now and see it it works......
omg it works this time!!! Thanks so much. : ) -
Essbase Visual Basic API - Help File locations
Hi,
I was wondering if anyone can help. Normally on XP Office 2003 I can get the VBA help via Help->Essbase Help. However I'm on Vista Office 2007 and when I goto the Add Ins->Essbase Help, I get an error that states:
Why can't I get Help from this program?
The Help for this program was created in Windows Help format, which was used in previous versions of Windows and it is not supported in Windows Vista.
For more information, see Windows Help program (WinHlp32.exe) is no longer included with Windows on the Microsoft support website.
So I need another way to access these help files.. Is there another way to do this??????
Thanks,
Samloading data from the VB api uses the import function. Look at http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_api/topapilist.htm for the system 9 version of the documentation. The document gives you samples for different functions you will need. from initialization, login, import, logout and termination
Maybe you are looking for
-
Accessing components in a different state
There's probably a more elegant way of doing this. Right now I'm setting certain components to be available in all states, but that means I need to make them visible or invisible depending on the state... which is a pain. How can I access a component
-
When entering a web page (e.g., www.aol.com) I would normally hit the ENTER key on my keyboard and the aol webpage would open. However, using Firefox 4.0.1 on my desktop, I have to enter the webpage (e.g., www.aol.com) and then use the mouse to right
-
How get OraOLEDB.Oracle messages from sql server
Hi, I am trying of get the oracle exception messages for linked server in sql server. With ERROR_MESSAGE() I get a generic error. How I can get the oracle errror with 'ORA-001' format ? thanks
-
Why won't my iPod Touch install iOS 5.1.1 so I can update to iOS 6
My iPod touch has automatically downloaded iOS 5.1.1 like a month ago and now I want iOS 6 but I have to install iOS 5.1.1 first. When I go to Settings > General > Software Update and tap Install Now then tap agree and then it says verifying update b
-
Desperately need some help with client-server java programming
Hi all, I'm new to client server java programming. I would like to work on servlets and apache tomcat. I installed the apache tomcat v 5.5 into my machine and i have sun java 6 also. I created a java applet class to be as a client and embed it into a