Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Ringo on December 12, 2004, 09:33 AM

Title: UPD Winsock for SCGS
Post by: Ringo on December 12, 2004, 09:33 AM
Hi, i was wundering if anyone could give me a little infomation on UPD winsocks and how to get it receveing and sending to a SC game server.

"Run time error '10047';"
Address family is not supported
Is all i can get from it :(

I noticed UserLoser say in a differnt post, that you dont connect to UDP or somthing, can anyone tell me more about this please?

Thanks in advance.
Title: Re: UPD Winsock for SCGS
Post by: The-FooL on December 12, 2004, 01:05 PM
The UDP protocol does not involve connecting somewhere.  You just send data to an address.
Title: Re: UPD Winsock for SCGS
Post by: Eric on December 12, 2004, 02:01 PM
Click (http://www.faqs.org/rfcs/rfc768.html)
Click (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingwinsockcontrol.asp)
Title: Re: UPD Winsock for SCGS
Post by: Banana fanna fo fanna on December 12, 2004, 04:51 PM
argh there is no "scgs"
Title: Re: UPD Winsock for SCGS
Post by: Yegg on December 12, 2004, 05:28 PM
Since we're on the topic of UDP and I don;t think I should start a new topic, which type of connection would be better to use, UDP or TCP?
Title: Re: UPD Winsock for SCGS
Post by: Banana fanna fo fanna on December 12, 2004, 07:10 PM
For what?
Title: Re: UPD Winsock for SCGS
Post by: Ringo on December 12, 2004, 08:20 PM
Hmm, i have learned alot more about the UPD protocol today.

But i am having a little trubble sending data via my UPD winsock because im not sure how to get the correct address :(


Dim MyIP As String, Doaway() As String
MyIP = Inet1.OpenURL("http://pchelplive.com/ip.php")
RemoteUPD.text = MyIP

then

    tagetIP = RemoteUPD.text
    Doaway = Split(TargetIP, " ")

    RemoteUPD.text = Doaway(0)


now i am useing RemoteUPD.text as my hostaddress and 6112 as hostport, but i know this is not the right/best way to obtain the right IP i am after. :'(

As i am coding this project on a networked computer, i noticed i am going about this wrong.

Does anyone have any idea how i can obtain my battle net IP address from my main TCP winsock just after sending/receveing 0x50 to use as a send address for my UPD winsock?

[VB]Anything will be of great help, thanks.
Title: Re: UPD Winsock for SCGS
Post by: UserLoser. on December 12, 2004, 10:46 PM
Quote from: Ringo on December 12, 2004, 08:20 PM
Hmm, i have learned alot more about the UPD protocol today.

But i am having a little trubble sending data via my UPD winsock because im not sure how to get the correct address :(


Dim MyIP As String, Doaway() As String
MyIP = Inet1.OpenURL("http://pchelplive.com/ip.php")
RemoteUPD.text = MyIP

then

    tagetIP = RemoteUPD.text
    Doaway = Split(TargetIP, " ")

    RemoteUPD.text = Doaway(0)


now i am useing RemoteUPD.text as my hostaddress and 6112 as hostport, but i know this is not the right/best way to obtain the right IP i am after. :'(

As i am coding this project on a networked computer, i noticed i am going about this wrong.

Does anyone have any idea how i can obtain my battle net IP address from my main TCP winsock just after sending/receveing 0x50 to use as a send address for my UPD winsock?

[VB]Anything will be of great help, thanks.

It's UDP.  And there's no connections (like stated many times in the past day or so).

Assuming you're using mswinsck.ocx, to get the IPv4 address of the remote host, try: socket.RemoteHostIP
Title: Re: UPD Winsock for SCGS
Post by: Ringo on December 13, 2004, 05:08 AM
ye, i understand that bit, but the main problem im having atm is understanding what address is used to do this.
When ever i packet log this, my SC game sends/receves from my ISP address @ port 6112, but when i send data to that via a UPD winsock and packet log it, its sending it to the address: 0.0.0.0.

Any ideas?

**Edit**
63.241.83.13:6112 > 192.168.0.135:4562    Recv 
FF 07 0A 00 02 00 00 00 00 00
(Passed 0x07)

0.0.0.0:4564 > :0   SendTo 
0000  09 00 00 00

I know i am only sending a blank UPD packet on logon but first i am trying to get the send to address right ;(

An example of how it should be:

63.241.83.13:6112 > 192.168.0.135:4562    Recv 
192.168.0.135:6112> :0   SendTo 

This is the sort of thing iv been trying (In VB6):



WsUPD.RemoteHost = WsTCP.RemoteHostIP
WsUPD.RemotePort = "6112"
PacketUPD &H9


Iv tryed:
WsUPD.RemoteHost = WsTCP.LocalIP

WsUPD.RemoteHost = WsTCP

WsUPD.RemoteHost = WsTCP.Remotehost

WsUPD.RemoteHost = my ISP address gotten from a php web address.

And many many other combos, but it will only seem to send to 0.0.0.0 and wrong port, rather than the port and IP i definded.

Please note: Im not trying to "connect" to my UPD winsock in anyway, i am purely having send address problems.

Or am i? any help would be great, thanks!
Title: Re: UPD Winsock for SCGS
Post by: Soul Taker on December 13, 2004, 09:31 AM
UDP.  D before P!  And, try binding the socket to a port first.  I honestly forget if you have to bind a UDP socket to just send a packet or not, but it's worth trying and I'm too lazy to look it up for you :P
Title: Re: UPD Winsock for SCGS
Post by: Adron on December 13, 2004, 12:33 PM
Depending on how you packet log it, it may be perfectly OK if it says it is seeing packets *from* 0.0.0.0.