Problem in In-Band and SOCKS5 streaming in IM mobile client


I am going to develop a IM mobile client and also want to provide small file transfer support. According to the XMPP protocol, the login, status change and sending messages mechanisms are working properly, but only the file transferring protocol is not working. While I am going to initiate the file transferring offer to the target, that time I’m getting error code 503(service unavailable) message from server in case of both IN-Band and SOCKS5 protocols. Though I have tried to implement the code several times following but I was failed to implement.

Can anybody please give me some right way to implement this file transferring module.

Here I have one more confusion, that for all xml request they are using one ID value and some times one SID value, can any body pls tell me, how can I achieve or generate that ID and SID value.

To implement this I am getting information from the following locations.

Please share your thoughts regarding this.