TCP in Blitz
BlitzPlus Forums/BlitzPlus Programming/TCP in Blitz
| ||
I got a magjor problum with the tcp server in blitz. When I try to use it over the internet it will connect but wont send or get packets. Works fine if I use a visual basic server but then if I do it that way the closes the connection in blitz client. I would like to go all the way with blitz as server and client but need know why I'm not geting packets when I go over the internet. I works on lan just fine. John |
| ||
TO add more to that incoming works but not out going and I don't have a firewall setup |
| ||
OK got it I was packet flooding I gess with my ping function. Now that brings upa new question how do I set a time out on the connection. SO my users don't get stuck in |
| ||
If someone could plz send me a working copy of a tcp server/client I can go from there (the one in archives isn't working for me) |
| ||
Posting just so you don't feel ignored ;c) I can't help you. The 2D project I am working on (and actually considering porting to B+) uses an old thirdparty 2D engine. It has directplay functions built in and that is what I am using. Perhaps there are some tutorials at Blitzcoder that may help you with the multiplayer stuff? If it is still being sold, Krylar's book gives very indepth on multiplayer, but it uses a thirdparty DLL. Please forgive any typos. I left my glasses in the other room, and I have 20/200 vision. |
| ||
look into using blitzplay. I think the original is still free to use. It's easier to use than the built in commands. |
| ||
The timeout: Have a var where you store the Millisecs() value every time a packet is recieved, then if Millisecs()-variable is too high, close the connection. You should send a dummy packet from the counterpart every once in while to make shure that the connection does not time out. |
| ||
ok UDP vs TCP I seen something that says udp is fast is it? Trying something as you read probly on tcp server ill let ya know if I get it to work. John |
| ||
Nope nothing heres accept readline code I got. Agine it works of me but no one else. And it can't be the router becuase im using my net ip so it runs though it and back just fine. strStream = AcceptTCPStream(svrGame) If strStream received_stream$ = strStream If ReadAvail(strstream) message$ = ReadLine$(strStream) DebugLog message$ EndIf Else For c.client = Each client If ReadAvail(c\stream) Then received_stream$ = c\stream the_user$ = c\uid$ c\pingtry=0 message$ = ReadLine$(c\stream) DebugLog message$ Exit EndIf Next EndIf EndIf |
| ||
befor you say it I know code is same as the chat server. once I get it to work at all ill change it |