Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Jul 16, 2018 4:02 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: No bind on sockets?
PostPosted: Tue Aug 23, 2011 4:43 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
lukus001 wrote:
I cant even see how one would use socketcore to add functionality for other protocol by forming your own packets? Cant even see how you could do a simple ping :/

The protocol you use has little to do with how you form packets.
POP, SMTP, HTTP and all those do not relay on being able to form custom packets.
What they do rely on is what's IN the packets.

I've actually used a TCP Socket to implement an entire API for an existing database (and I know others have as well) and nothing required being able to write or accept custom packets.

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Tue Aug 23, 2011 5:32 pm 
Offline

Joined: Sat Jul 16, 2011 2:45 pm
Posts: 76
npalardy wrote:
The protocol you use has little to do with how you form packets.
POP, SMTP, HTTP and all those do not relay on being able to form custom packets.
What they do rely on is what's IN the packets.

I've actually used a TCP Socket to implement an entire API for an existing database (and I know others have as well) and nothing required being able to write or accept custom packets.
HTTP is encapsulated in TCP. HTTP headers are put under TCP headers which in turn is under the IP header.

So if you wanted to send a ping packet (which, afaik doesn't use TCP but ICMP and would require a RAW socket to be formed, since RS doesn't have a direct implementation of it?). you can't do it with "RS' sockets". That means No pinging or tracerouting possible unless you do the linux UDP method which isnt as reliable.

Or even, say you wanted to test your application when receiving malformed TCP packets by purposely editing them incorrectly?

I'm just surprised since RS sockets are abstracted from the OSes' sockets quite a bit. I can understand high abstraction with easytcp etc.. (I know being Object oriented, sockets would be abstracted away from their origins)

I was however associating "socketcore" with "RawSockets" since TCPsockets come from SocketCore. Of course, that means nothing at the end of the day other than me just assuming (or expecting) Socketcore to have added a more, lower-level access to sockets.

For my application I'm going to have to implement Adobe's RTMP protocol. That's done under TCP which is fine, I'll also have to implement XMPP which again is fine. I would, however like to set the local port on my TCP packets though as a client ^^ which doesnt seem to be possible with RS


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Tue Aug 23, 2011 5:53 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
lukus001 wrote:
npalardy wrote:
The protocol you use has little to do with how you form packets.
POP, SMTP, HTTP and all those do not relay on being able to form custom packets.
What they do rely on is what's IN the packets.

I've actually used a TCP Socket to implement an entire API for an existing database (and I know others have as well) and nothing required being able to write or accept custom packets.
HTTP is encapsulated in TCP. HTTP headers are put under TCP headers which in turn is under the IP header.

So if you wanted to send a ping packet (which, afaik doesn't use TCP but ICMP and would require a RAW socket to be formed, since RS doesn't have a direct implementation of it?). you can't do it with "RS' sockets". That means No pinging or tracerouting possible unless you do the linux UDP method which isnt as reliable.

Or even, say you wanted to test your application when receiving malformed TCP packets by purposely editing them incorrectly?

I'm just surprised since RS sockets are abstracted from the OSes' sockets quite a bit. I can understand high abstraction with easytcp etc.. (I know being Object oriented, sockets would be abstracted away from their origins)

I was however associating "socketcore" with "RawSockets" since TCPsockets come from SocketCore. Of course, that means nothing at the end of the day other than me just assuming (or expecting) Socketcore to have added a more, lower-level access to sockets.

For my application I'm going to have to implement Adobe's RTMP protocol. That's done under TCP which is fine, I'll also have to implement XMPP which again is fine. I would, however like to set the local port on my TCP packets though as a client ^^ which doesnt seem to be possible with RS


RS sockets aren't raw sockets - for good reason .... most users don't ever need that or anything close to it.
If you do just call the os functions with declares & get access to raw sockets that way but it will be different API's on each platform.

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Wed Aug 24, 2011 10:31 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
lukus001 wrote:
Thom,

I'm on about clients not servers, sorry for any confusion :(

When i connect to google.com:9000 how does google know who i am? it cant send me the web page unless I tell it that my IP is 77.101.214.40.

Connect is going to tell google "77.101.214.40" and then a random free port on my computer to use to reply to. Thats the standard functionality of sockets you find built into an operating system?


I know you're talking about writing a client, but it doesn't change the fact that by connecting to another computer, you're bringing a server into the mix. How that server behaves is important.

When you connect to a server, one of two things will happen. Either the server replies on the port you connected to, or it moves your connection to a different port, then replies. This is decided by the needs of the server. If you're interested, you can check the port property at any time to see what port you're currently using, but it makes no functional difference.

Which keeps bring up my question about what problem you're trying to solve. I don't mean any "in theory" situations. What have you tried so far? What is not working as you expected? What is it you expect instead. We can help you solve these problems in a practical setting, rather than all this "what if" stuff that may not actually get you closer to a solution.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Wed Aug 24, 2011 10:40 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
lukus001 wrote:
HTTP is encapsulated in TCP. HTTP headers are put under TCP headers which in turn is under the IP header.


Splitting hairs here, but HTTP headers are not part of the TCP headers. They are part of the TCP packet body. TCP is a the transport layer, HTTP is the protocol or application layer. There's no reason HTTP couldn't work over UDP, for example, aside from it being pointless.

Yes, the RS TCPSocket does not give you 100% control over the TCP packet header. If you have a compelling need to do something special with the packet header, Norman is right, you'll have to create your own socket class using declares. But in all my years of writing software, many of which have entirely custom protocols, I have never needed to muck with the TCP header. Not even close.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Wed Aug 24, 2011 1:14 pm 
Offline

Joined: Sat Jul 16, 2011 2:45 pm
Posts: 76
Thom McGrath wrote:
I know you're talking about writing a client, but it doesn't change the fact that by connecting to another computer, you're bringing a server into the mix. How that server behaves is important.

When you connect to a server, one of two things will happen. Either the server replies on the port you connected to, or it moves your connection to a different port, then replies. This is decided by the needs of the server. If you're interested, you can check the port property at any time to see what port you're currently using, but it makes no functional difference.

Which keeps bring up my question about what problem you're trying to solve. I don't mean any "in theory" situations. What have you tried so far? What is not working as you expected? What is it you expect instead. We can help you solve these problems in a practical setting, rather than all this "what if" stuff that may not actually get you closer to a solution.
Hi thom,

I don't have anything wrong with my program, at least not yet. However the program is an unofficial client for a game that I've reversed engineered (to explain it in the simplest and quickest manner). Their official client has quite a lot of problems, such as when two people are trying to use the same connection they get forced disconnections from the chat system as well as other disconnect problems which is what im trying to "future proof" my application for so I have to base some or a lot of it on "what if" case scenarios and I have to make assumptions based on their inner workings.

I know that doesn't really help you very much either, but I honestly can not give you a clear answer myself and that's one of the struggles of reverse engineering someone else system without documentation. (Plus their program is just messy :( )

In most games (in my experience) this is a port issue and practically all resources on the Internet with <insert game here> would say its a port issue due to both clients wanting to share the same port range. A lot of games therefore have an option to define your own local ports and bypass this issue, which is what I wanted to implement on my client even if it did happen to be unnecessary.

I think most routers are capable of correctly routing peoples connections regardless (possibly some form of TCP ID hooking) but then there are some that cant :3.

All my wireshark traces happen to be on my PC that decided to break last week too, but I do not have reason to believe the game is changing the ports because they have a defined set of ports on their website for people to declare in their firewalls etc.. So we can say there is likely a range of 5 or so ports being used by the server. Even if the server did change it's port, that wouldn't matter to the client application when receiving data from server? which is where the problem should reside.

Again the *problem" is on a program not made by me so I -have to assume- it's because they get one or two same local ports and inbound messages are getting hijacked by the second client. It could be that me using a random port may even fix that but again, this is assumptions.

I'd rather build the ability into the application so that people who can test 10 clients under one connection for a 5v5 game have the option there at hand. If it isn't necessary I can then always phase it out.

- I wasnt saying HTTP was TCP; only that it is encapsulated in them and yes that means the HTTP headers goes under the TCP ones as part of the TCP packet body. Just as TCP is encapsulated Under IP ;/. So yes, it can go under UDP apart from the fact that it requires a reliable transport layer which UDP isnt ;)

Thanks again for your reply (and patience)

I am happy to go down the declares route and get the functionality from that though. One application I did want to do was a traceroute which, requires an ICMP packet so I would have to do it this way :) (the non linux UDP traceroute method at least)

And once again, thank for the replies everyone, it is much appreciated.


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Wed Aug 24, 2011 1:21 pm 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
I still think this is a server issue. I think the server (which is out of your control) is attempting to disconnect you based on IP address. That's a bad server. Nothing you can do about that.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: No bind on sockets?
PostPosted: Wed Aug 24, 2011 2:18 pm 
Offline

Joined: Sat Jul 16, 2011 2:45 pm
Posts: 76
Thom McGrath wrote:
I still think this is a server issue. I think the server (which is out of your control) is attempting to disconnect you based on IP address. That's a bad server. Nothing you can do about that.
This might be true actually, the thought never passed my mind! Thanks.

I know their login takes your IP address as an input along with username+pass etc so they might be doing something strange IP-based on their end.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group