login
login
login
login
login
login login login login login login login login
login login
login
Go Back  Xtreme Visual Basic Talk > > > login


Reply
 
Thread Tools Display Modes
  #1  
Old 11-29-2004, 07:43 AM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default login


how would i go about sending login and password info from a client to a server and checking that info within a access database and returning if true player info?
thanks
Reply With Quote
  #2  
Old 12-01-2004, 01:39 PM
excaliber's Avatar
excaliberlogin excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Well, you have several options.

You could POST (http header) to a script on a site, sending the login stuff as an argument, using httpwebrequest or webclient.

You could create a web service and connect to it using Remoting, sockets, etc

You could create a binary server (executable) and connect to it using remoting, sockets, tcpclient, etc
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #3  
Old 12-03-2004, 05:57 AM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

Quote:
Originally Posted by excaliber
Well, you have several options.

You could POST (http header) to a script on a site, sending the login stuff as an argument, using httpwebrequest or webclient.

You could create a web service and connect to it using Remoting, sockets, etc

You could create a binary server (executable) and connect to it using remoting, sockets, tcpclient, etc

on my server im using sockets to create the listener then bracking of my main listen loop into a thread, so the server will be multi threaded. how would I go about handling the info on the server end? im using guid to number each connection and saving it into a hashtable, my server is a console app, my other idea is to create a sub and loop all the connections/threads through this sub, within this sub I would be using the select case statment, am i going to have problems runing multiple threads within one sub?
thanks for the help
smacker
Reply With Quote
  #4  
Old 12-03-2004, 01:48 PM
excaliber's Avatar
excaliberlogin excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Well, since you are already using sockets, might as well use them client side as well. Just open up a connection to your server and send your login credentials.

As to storing, you may do that however you like. I typically make a class (called Netclient) that stores vital information per connection. For example, there would be an array of netclients (one for each client), wihch would contain the socket, various state flags, encryption values, etc.
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #5  
Old 12-04-2004, 06:03 AM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

I guess the thing I dont understand is after I send something to from the client to the server how I go about triggering a event, like I send the login and pass from a textbox to the server how would i go about on the server end checking that info, I understand the "SELECT FROM" statment, but triggering that code is what i dont get, do i declare the same varibles on the server and client send it like "send(login"::", & logintxt.text)"? and on the server side create a "if else endif" statement and loop it to handle all the recive options?
thanks for the help
Reply With Quote
  #6  
Old 12-04-2004, 09:24 AM
excaliber's Avatar
excaliberlogin excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Yep. You need to develop some type of protocol that is used by server/client. For instance, your client will send, every time, a string that contains this info:

"login:username:password~"

Where "login" is the command, ":" is the delimeter and "~" is the packet delimeter (so you can split packets). Sever side, you would need to parse that out into whatever you need to do. That parsing would happen in the Recieve event for the socket.

Couple of notes. That above is a textual protocol (much like HTTP) and has limitiations. For instance, you can't send any text that has a colon ":" or tilda "~" in it, or else it will mess up your parsing. Also, it is kinda bloated (a string needs one byte per character, meaning the command "login" needs 5 bytes). My protocols are typically binary protocols. This means each command is represented by a single byte value (login =1, filesend=2, etc), which cuts down size. That is not needed for everything though.

Second note. If you don't need a super high performance server capable of handling many clients, etc etc (essentially, you have no intention of using the advanced features of sockets like asynchrounous and the like) you may wish to use remoting.

http://www.codeproject.com/vb/net/RemotingTech.asp
http://www.c-sharpcorner.com/Network/RemotingInNETM.asp
http://www.developer.com/net/cplus/article.php/1479761 (seems to be down, us GCache: http://64.233.167.104/search?q=cache...ient=firefox-a)
MSDN

It simplifies everything greatly. Instead of sending things, you can just call a "method" on the remote computer, passing whatever arguments you need. It wraps everything up so it looks like normal method calling, and makes life a lot easier (unless you need the application to scale a lot)
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #7  
Old 12-04-2004, 09:17 PM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

i have aready created my asynchrounous send/Recieve class and it works great but i would love to look into remoting more. Thanks for the help
smacker
Reply With Quote
  #8  
Old 12-06-2004, 02:21 PM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

is there a way serverside i can put a limit to the number of clients connecting to the server from one ip(would like to set it to 3), right now im using the ip and port number to track each client and thats saved into a hashtable
thanks
Reply With Quote
  #9  
Old 12-06-2004, 04:16 PM
excaliber's Avatar
excaliberlogin excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Thats generally how I would do it. If there are more than 3 connections from one IP, drop the connection.
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #10  
Old 12-06-2004, 06:22 PM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

Quote:
Originally Posted by excaliber
Thats generally how I would do it. If there are more than 3 connections from one IP, drop the connection.

think you could point me into the direction on coding that, I been racking my brain on this one and cant figure it out
thanks
Reply With Quote
  #11  
Old 12-07-2004, 05:19 AM
excaliber's Avatar
excaliberlogin excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Well, keep an array or hashtable of IP's and socket's (or socket ID's, or however you want to keep track of sockets). When a new socket connects, loop through the array of IP's and compare it to the new socket's IP. If it has the same IP, increment a counter. Everytime you increment, check to see if the counter is now 4. If it is, exit the loop and drop the connection. Otherwise, continue looping. If you get to the end and the counter is still 3 or less, accept the connection.
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #12  
Old 12-10-2004, 06:10 AM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

ok, my server is a console app so to create a counter I would use PerformanceCounter right?
this is new to me but seems very helpful, and I got it working but cant seem to get the code right so it ends at the 4th
here's what I did
not sure how to put the vb tag in sorry

Public threadtable As New Hashtable(200)


ClientIp = IPAddress.Parse(CType(client.RemoteEndPoint,_ System.Net.IPEndPoint).Address.ToString()).ToString

Dim count As New Diagnostics.PerformanceCounter
count = New Diagnostics.PerformanceCounter("ip", "ip count", False)
count.RawValue = 0

for each D in threadtable
clientip = clientip.clone
count.IncrementBy(1)
next

if count.Nextvalue = 4 then
client.close
end if


am I close?
right not the counter is moving im checking it by using
"console.writeline(count.rawvalue)"
but its not closing the socket after the 4th connection
thanks
Reply With Quote
  #13  
Old 12-10-2004, 04:11 PM
excaliber's Avatar
excaliberlogin excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Why are you using PerformanceCounter? Why not just a simple variable.

Anyhow, yes, that code looks fine. If it works for you, it works
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #14  
Old 12-12-2004, 08:40 PM
smacker smacker is offline
Regular
 
Join Date: Aug 2004
Posts: 89
Default

Quote:
Originally Posted by excaliber
Why are you using PerformanceCounter? Why not just a simple variable.

Anyhow, yes, that code looks fine. If it works for you, it works


ok its not working and here is the reason why i think
im saving the connected ip and port into a hashtable together, I have two varibles clientip and clientport
dim s as string = clientip + clientport <---thats what im saving into my hashtable

if i just save clientip i get a error whenever 2 of the same ip's try to connect so i decided to add in the port
so is there a way to still only allow 3 connections from one ip?
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
login
login
login login
login
login
login login login login login login login
login
login
 
login
login
 
-->