Jump to content

help me pleas....


Recommended Posts

hi i'm testin with the server and client thing but i have only one question i want that when i'm connected to the server it needs to check if a $var is 1 or 0 how do i need to do that???

this is the code i have now

server

;SERVER!! Start Me First !!!!!!!!!!!!!!!

$g_IP = "127.0.0.1"

; Start The TCP Services

;==============================================

TCPStartUp()

$stream = 1

; Create a Listening "SOCKET"

;==============================================

$MainSocket = TCPListen($g_IP, 65432, 100 )

If $MainSocket = -1 Then Exit

MsgBox(4096, "Test", $stream )

; look for client connection

;--------------------

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

If $ConnectedSocket >= 0 Then

msgbox(0,"","my server - Client Connected")

TCPSend($ConnectedSocket, $stream)

EndIf

Wend

client

;CLIENT!!!!!!!! Start SERVER First... dummy!!

$g_IP = "127.0.0.1"

; Start The TCP Services

;==============================================

TCPStartUp()

; Connect to a Listening "SOCKET"

;==============================================

$socket = TCPConnect( $g_IP, 65432 )

If $socket = -1 Then Exit

$stream = TCPRecv( $g_IP, 2048 )

MsgBox(4096, "Test", $stream )

can somebody tell me that when i run it i get on the client no $stream he say its emty how is that possebel. ??? what i'm doining wrong i say in the server that its $stream = 1 ????

Edited by yucatan
Link to comment
Share on other sites

hi i'm testin with the server and client thing but i have only one question i want that when i'm connected to the server it needs to check if a $var is 1 or 0 how do i need to do that???

this is the code i have now

server

;SERVER!! Start Me First !!!!!!!!!!!!!!!

$g_IP = "127.0.0.1"

; Start The TCP Services

;==============================================

TCPStartUp()

$stream = 1

; Create a Listening "SOCKET"

;==============================================

$MainSocket = TCPListen($g_IP, 65432, 100 )

If $MainSocket = -1 Then Exit

MsgBox(4096, "Test", $stream )

; look for client connection

;--------------------

While 1

$ConnectedSocket = TCPAccept( $MainSocket)

If $ConnectedSocket >= 0 Then

msgbox(0,"","my server - Client Connected")

TCPSend($ConnectedSocket, $stream)

EndIf

Wend

client

;CLIENT!!!!!!!! Start SERVER First... dummy!!

$g_IP = "127.0.0.1"

; Start The TCP Services

;==============================================

TCPStartUp()

; Connect to a Listening "SOCKET"

;==============================================

$socket = TCPConnect( $g_IP, 65432 )

If $socket = -1 Then Exit

$stream = TCPRecv( $g_IP, 2048 )

MsgBox(4096, "Test", $stream )

can somebody tell me that when i run it i get on the client no $stream he say its emty how is that possebel. ??? what i'm doining wrong i say in the server that its $stream = 1 ????

Dude, please use the code tags to put information on these pages, makes it much easier to read.

Secondly, if your server is unattended, the following snippet:

While 1
$ConnectedSocket = TCPAccept( $MainSocket)
If $ConnectedSocket >= 0 Then
msgbox(0,"","my server - Client Connected")
TCPSend($ConnectedSocket, $stream)
EndIf
Wend

Is going to cause you problems. As long as that msgbox(0...) is in there, it will wait for a response from the owner of the server BEFORE continuing onto the next line. You should probably write that to a file with FileWrite() or just to the console as consoleWrite().

Secondly, to echo the confusion from the poster above me....huh? Your description of the problem is a bit vague, not sure what you want to test here.

But, to test if a variable is 1 or 0, you could always do an if check:

if $stream = 1 then
  consolewrite("Stream is 1"&@crlf)
elseif $stream = 0 then
  consolewrite("Stream is 0"&@crlf)
else
  consolewrite("Stream is not 1 or 0, but something else!  Data: "&$stream&@crlf)
endif

Note the above if statement will check if stream is equal to 1 or 0 and write that information to the console, and if it is not equal to 1 or 0 but to something else, it will write that as well.

If you wanted to test for that each time a user is connected, you could always add that if check right after the TCP Sock send. But, accoridng to your script, your just sending a 1 anyway whenever a client connects, so not sure how to help you here.

PLEASE Provide more detail on what you want.

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Dude, please use the code tags to put information on these pages, makes it much easier to read.

Secondly, if your server is unattended, the following snippet:

While 1
$ConnectedSocket = TCPAccept( $MainSocket)
If $ConnectedSocket >= 0 Then
msgbox(0,"","my server - Client Connected")
TCPSend($ConnectedSocket, $stream)
EndIf
Wend

Is going to cause you problems. As long as that msgbox(0...) is in there, it will wait for a response from the owner of the server BEFORE continuing onto the next line. You should probably write that to a file with FileWrite() or just to the console as consoleWrite().

Secondly, to echo the confusion from the poster above me....huh? Your description of the problem is a bit vague, not sure what you want to test here.

But, to test if a variable is 1 or 0, you could always do an if check:

if $stream = 1 then
  consolewrite("Stream is 1"&@crlf)
elseif $stream = 0 then
  consolewrite("Stream is 0"&@crlf)
else
  consolewrite("Stream is not 1 or 0, but something else!  Data: "&$stream&@crlf)
endif

Note the above if statement will check if stream is equal to 1 or 0 and write that information to the console, and if it is not equal to 1 or 0 but to something else, it will write that as well.

If you wanted to test for that each time a user is connected, you could always add that if check right after the TCP Sock send. But, accoridng to your script, your just sending a 1 anyway whenever a client connects, so not sure how to help you here.

PLEASE Provide more detail on what you want.

first question how do i set my code in a window like u have.

Link to comment
Share on other sites

This line is wrong:

$stream = TCPRecv( $g_IP, 2048 )

Should be:

$stream = TCPRecv( $socket, 2048 )

i'v already got it working what i wanne ask to you guys is to look at my code. when you read my code you will understand.

what i want is that when i ru the streamer that it registrat my IP adress and when i use the checker it needs to look if you have all the steps of the streamed if yes send back to the pc where the checker is runned that the pc have the prog pleas look to the code if you guys have any ideas/advice pleas help me then p.s. pleas merge the 2 server progs.

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...