"invalid TCP Stream" Error on Remote Computer
BlitzPlus Forums/BlitzPlus Beginners Area/"invalid TCP Stream" Error on Remote Computer
| ||
If you have read the previous two posts on this forum, you have a pretty good idea of what i am trying to do. However, whenever i try to us my TCP commands in an executable to communicate with my computer, the remote(not mine) computer always gets the error "Invalid Stream" or something to that effect. Could this be due to the firewall that came with my recent DSL? Am i just not setting up the server right in the local code? Does my computer just know which programs i made and make them not work? I'm placing the source below. Please help me out. |
| ||
-------------------------------------Server Code------------------------------- Global fileout Remote=CreateTCPServer(1026) If Remote<>0 Then Print "Server started successfully." Else Print "Server failed to initialize." Delay(2000) End End If Print "awaiting connection..." While stream = 0 stream=AcceptTCPStream(Remote) Wend Compname$ = ReadString$(stream) Print "Connected To Computer " + Compname + " at " Print TCPStreamIP(stream) fileout=WriteFile("C:\" + Compname + ".txt") While Not KeyHit(1) Stream=AcceptTCPStream(remote) If Stream Then Print ReadString$(stream) WriteLine(fileout,ReadString$(stream)) End If Wend ------------------------------------Remote Code--------------------------------- Global xdir2$ = "" Global xdir Global xname$ = "C:\" Print "working..." TCPHome=OpenTCPStream("192.168.1.102",1026) WriteString TCPHome,GetEnv("computername") ;CloseTCPStream tcphome Delay(1000) If TCPHome <> 0 Delay(100) xdir = ReadDir(xname$) Repeat FILE=OpenTCPStream("192.168.1.102",1026) xdir2$=NextFile$(xdir) If xdir2 = "" Then Exit If FileType(xname$+"\"+xdir2) = 2 WriteString FILE,("Folder: " + xname$ + xdir2) Else WriteString FILE,("File: " + xname$ + xdir2) End If Delay(100) CloseTCPStream FILE Forever EndING=OpenTCPStream("192.168.1.102",1026) WriteString EndING,"Program Successfully Executed. Exiting Now" End If CloseTCPStream tcphome CloseTCPStream ending Print "done!" I use port 1026 to bypass the WinXP firewall. This is not the exact code which i have been playing around with at home because im posting this at school. |
| ||
What are the forum codes? |
| ||
Thanks for the hints man but still it doesn't much help me out. I would have appreciated a straight up answer just as much... |
| ||
Sorry, but I don't always have time to answer. I do what I can, when I can, and todays not the day. |
| ||
I think i figured it out. After going over my code for a few hours, I finally gave up and called Brightnet. After clarifying that I was using the firewall that came with their DSL, I acquired the useful bit of information that I cannot be connected to by an outside computer. Ergo, whenever teh remote computer attempted to contact mine, my firewall said "Hey, screw you man. No way you're getting in there," and refused their connection. This is quite annoying as the person I tried to connect to also has Brightnet DSL. So, in other words, I'm screwed. |
| ||
You shouldn't be screwed. Just set up your firewalls to open the ports you want to use (or am I missing something?). |
| ||
"Brightnet" has a firewall for you in their office? |
| ||
lol it turns out i'm completely screwed up. When i asked my dad he SAID that it was THE brightnet firewall meaning the firewall between us and brightnet. It's actually some linksys firewall or something that you can manipulate, not the one that brightnet themselves said sucked for programming. I then found out that i actually didn't know my IP as well. Apparently the router for (at least our) DSL modems assigns you a network IP automatically that windows mistakes for your actual IP. To find out your real IP go to http://www.ipchicken.com/. |
| ||
that's pretty standard. What you would need to do, is set up a port forward in your linksys router: You have to decide on a port for your application to use, go into the linksys admin interface (most likely by webbrowser to http://192.168.1.1 ), and add a rule for a port forward for the number you picked (should be above 1024 so you won't interfere with other programs!) You then point this port to the internal IP address of your computer. To find out what it is, open a command prompt on your computer and type: ipconfig (you ought to configure your router to assign your computer an IP statically based on your mac address as well, so you will nkow for sure that its IP address won't change in the future) From that moment on, any incoming connection to your 'real' IP on that port number will be directed to your own computer, where your program can answer the connection. If you also want to be able to initiate a connection on your end and connect to your friends system, he would need to do the same on his end as well. (You nly need the port forward for the computer that receives the initial connection command: You the linksys will by default let any responses through on requests that you initiated yourself) |