Jump to content

server help!


Recommended Posts

ok im intrested in TCP/UDP, im noob at networking, and got a defined project:

i want a rank system (Ex: recruit, private) for my clan.

the system is:

i add pts, when they reach a number of points they rank up.

what i want is a system so they can know their actual pts and theyr rank.

YES i have searched in google.

YES i have searched here.

NO i have not found.

i got knowledge of autoIT, but TCP,

hope u all got a happy xmass and Happy New Year!

hope i learn this b4 2010 =D

Link to comment
Share on other sites

Did you try the example scripts under TCPRecv()/TCPSend() in the help file? Start from there.

;)

ty for quick awnser, wow Psalty im ur fan, and yeah, also the 403Forbidden tutorial on youtube, but idk how to make the rank system, so

Client connects on server (more than 1 client) and server sends information to client.

in spanish:

a clan member connects to my program (more than 1 member) and my program sends their rank and pts to the member.

oh and another thing:

is it possible for the server to be dedicated? hostings? anything?

Edited by InmortalStudios
Link to comment
Share on other sites

You repeat the part about more than one client. Have you even coded it for a single client yet? Start small and work up to the full functionality. When you get stuck, post some code that demonstrates where you are stuck and get some help toward the next step.

If what you really need is someone to write it for you, see the Rent-A-Coder link in my sig.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

If what you really need is someone to write it for you, see the Rent-A-Coder link in my sig.

:evil:

yes, i started programming because i want to make my own ;) .

so what the logic about?

is this ok?

Server:

;Rank System
$ini= @HomeDrive & "\inmortalstudios\info.ini"
TCPStartup ( )
MsgBox (0, "", @IPAddress1)
$Socket= TCPListen (@IPAddress1, 403)
$ASocket= TCPAccept ($Socket)
Until 1 = 2

Do
$username= TCPRecv ($ASocket, 10000000)
Until $username <> ""

Do
$rank= TCPRecv ($ASocket, 10000000)
Until $rank <> ""

IniWrite ($ini, $username, "rank", $rank)

Client:

TCPStartup ( )
$ip= "192.168.1.34"
$server= TCPConnect ($ip, 403)
$username= InputBox ("", "Username:")
TCPSend ($server, $username)
sleep (1000)
TCPSend ($server, "no rank")
TCPShutdown ( )
Link to comment
Share on other sites

UPDATED CODE:

i got an error, server dont writes the ini:

Server:

#Include <File.au3>
;Rank System
Global $ini= @ScriptDir & "\info.ini"

if FileExists ($ini) Then
MsgBox (0, "Welcome", "Welcome")
Else
_FileCreate ($ini)
EndIf

TCPStartup ( )
MsgBox (0, "", @IPAddress1)
$Socket= TCPListen (@IPAddress1, 403)
Do
$ASocket= TCPAccept ($Socket)
Until 1
Do
Global $username= TCPRecv ($ASocket, 10000000)
Until $username <> ""
Do
Global $rank= TCPRecv ($ASocket, 10000000)
Until <> ""

IniWrite ($ini, "soldier", $username, $rank)

Client:

#Include <File.au3>
;Rank System
Global $ini= @ScriptDir & "\information.ini"

if FileExists ($ini) Then
MsgBox (0, "Welcome", "Welcome")
Else
_FileCreate ($ini)
EndIf

TCPStartup ( )
$ip= "192.168.1.34"
$server= TCPConnect ($ip, 403)
$username= IniRead ($ini, "soldier", "username", "")
if $username= "" Then
    $username= InputBox ("", "Enter your username")
    IniWrite ($ini, "soldier", "username", $username)
EndIf
TCPSend ($server, $username)
sleep (1000)
$rank= IniRead ($ini, "soldier", "rank", "")
if $rank = "" Then
    IniWrite ($ini, "soldier", "rank", "recruit")
    $rank= "recruit"
EndIf
TCPSend ($server, $rank)
TCPShutdown ( )

ty for help up to now

Link to comment
Share on other sites

OK, when you TCPAccept() the connection, you get a unique socket ID for each connection. To have multiple clients you will want to track currently active sockets with an array. Then you will need to walk the array of sockets, doing TCPRecv() for each socket and dealing with each in turn.

Examples of this have been posted.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ok, so the last code was ok for many connections? :evil:

No, you only have a single variable to hold the socket ID, so it can only handle one connection. If you don't know how to use an array yet, then this project is not a good place to start.

i searched examples, i dont found. where? :idea:

Try "+multiple +TCP +connections" in the search.

how to make a DEDICATED (all time) server? any hosting (paid or free)? :evil:

Not an AutoIt question.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ok so i can only make one Recv for 1 connection?

You need to Recv for EACH connection (socket).

why cant my code write in the ini?

The client or the server? Try separating the INI stuff temporarily into a different test script and debug from there, then put the fix back into the larger script.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...