( search forums )
Soldat Rating System
Soldat Forums - Soldat Talk - Developers Corner
Nex
December 3, 2005, 1:30 am
Hi

I am currently trying to make a soldat server that rates all the people who play it and i was wondering if anyone here can connect to a soldat server using visual basic.

I want to use wisual basic for this beacuse im going to make a server from scratch and VB is the easyest way to do it.

Can anyone help me with this problem.

Everytime i try to connect to a soldat server using visual basic it says "connection forcefully regected".

Heres my code

Private Sub Form_Load()
Winsock1.Connect "144.139.125.7", "23073"
End Sub

its verry basic but it dosent work

does anyone have any suggestions?

FliesLikeABrick
December 3, 2005, 2:48 am
as soon as you connect via TCP with anything, you need to send the admin password otherwise you get disconnected (which is what is happening to you)

It has been a while since my VB days, and enesce can help you more than me, but when Winsock1.connected send the admin password to the connection, from then on you will recieve all admin and console data.

Nex
December 3, 2005, 3:24 am
How do you do that?

i tried

winsock1.connect "-------", "----" //whateva the ip/port was
winsock1.senddata "password" //which is the servers password

and it said invalid protocoll or connection type to perform your action

FliesLikeABrick
December 3, 2005, 5:47 pm
I believe it is like this:
Private Sub Winsock1.Connected()
winsock1.senddata "password"
End Sub

Like I said , i'm very rusty and you should talk to/wait for enesce to show up

DePhille
December 3, 2005, 6:42 pm
What a hell of a coincidence!

I just wrote (err , I think it's an hour ago) the script to connect to a server.
In the first post I think you tried to connect to a wrong IP , if you connect to your local PC your IP is 127.0.0.1 , not the thing you find on the internet.
In the second post you posted you tried to send something while the winsock wasn't even connected yet

FliesLikeABrick is right but he forgest just one tiny thingy: vbcrlf.

Here's the code:
Private Sub Winsock1_Connect()
Winsock1.SendData text3.text & vbCrLf 'password
end sub

Private Sub Command1_Click()
Winsock1.Connect Text1.Text, Text2.Text 'IP and Port
End Sub

Also , if you send a command don't forget to put vbcrlf in the end!

Grtz , DePhille

FliesLikeABrick
December 3, 2005, 7:43 pm
ah yeah, i completely forgot that Dephille is a VB buff as well

Nex
December 4, 2005, 12:29 am
sorry thats not working,

my winsock dosent even make it to the connected event

it just generates an error "Connection Forcefully Regected"

DePhille
December 4, 2005, 9:28 am
That means you are unable to connect to the server.
Where are you connecting to?

Grtz , DePhille

Nex
December 4, 2005, 10:12 am
To my own soldat server over the net

Nex
December 4, 2005, 10:18 am
If it helps im using...
Windows 98 SE
Visual Studio 6.0 (visual Basic 6.0)
No Firewall
Dial-Up Net


DePhille
December 6, 2005, 2:53 pm
Is that own server running on the same PC as the app you're making?

Nex
December 7, 2005, 11:37 am
Yes

DePhille
December 8, 2005, 12:39 pm
Connect to 127.0.0.1 as IP instead of the other one.
You can't connect to your own PC with any IP address that differs from 127.0.0.1 , otherwise it'll return the error you're getting.

Grtz , DePhille

Nex
December 9, 2005, 5:02 am
Still Dosent work,

same error message

Deleted User
December 9, 2005, 6:45 am
have you even set the correct port.... try the IP as localhost aswell

DePhille
December 9, 2005, 8:37 am
you do have a winsock that's listening huh?
like
Winsock1.localport = 23000
winsock1.listen

And then when you connect:
Dim IP_Address as string
IP_Address = text1.text 'Type 127.0.0.1 in here since you connect to your own PC
Winsock2.connect IP_Address , 23000

That should definitely do the trick if done right.

Grtz , DePhille