News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Win32 Socket Send problem

Started by justnew, November 28, 2010, 12:23:18 PM

Previous topic - Next topic

justnew

Hi guys
First of all thank you for this very helpful board and please excuse my bad english :).

So now to my problem:
After hours of reversing the XMPP I did a tiny Jabber-Bot in Python.
Now I tryed to recode this in MASM but I it wasn't succesful.
I connect to the server and try to send the string to start a stream but eax says that "send" sended 0 bytes.
Here ist a part of my Code:

call conn ;no error (connects to server)
.data
tmp db "kleiner als 0",0 ;means "lower as 0"
strsend db "send",0
strrecv db "recv",0
buff db 2048 dup(0)
str2 db '" xml:lang="de" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">',0
str1 db '<?xml version="1.0"?> <stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xmlns="jabber:client" to="',0

.code
invoke lstrcat,addr str1,addr server
invoke lstrcat,addr str1,addr str2
invoke MessageBox,0,addr str1,addr strsend,MB_OK
invoke lstrlen,addr str1
invoke send,s1,addr str1,eax,0
cmp eax,0
jg nnn
invoke MessageBox,0,addr tmp,addr tmp,MB_OK
nnn:
invoke recv,s1,addr buff,sizeof buff,0
invoke closesocket,s1
invoke MessageBox,0,addr buff,addr strrecv,MB_OK


I hope someone finds the error.
Thank you and greets

oex

Quote from: justnew on November 28, 2010, 12:23:18 PM
After hours of reversing the XMPP I did a tiny Jabber-Bot in Python.

Forum Rules
http://www.masm32.com/board/index.php?topic=31.0

"no cracking and similar activities in the guise of "Reverse Engineering", no hacking techniques or related technology and no support or help with or reference to pirated software"

But also wondering why you would bother reversing an open standard :lol
http://xmpp.org/about/
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

hutch--

I am no net jockey but from the code you posted you need to check how your "send" and "recv" functions are set up and what the return values are to see if you can find the error.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

justnew

Quote from: oex on November 28, 2010, 12:33:23 PM
Quote from: justnew on November 28, 2010, 12:23:18 PM
After hours of reversing the XMPP I did a tiny Jabber-Bot in Python.

Forum Rules
http://www.masm32.com/board/index.php?topic=31.0

"no cracking and similar activities in the guise of "Reverse Engineering", no hacking techniques or related technology and no support or help with or reference to pirated software"

But also wondering why you would bother reversing an open standard :lol
http://xmpp.org/about/

Don't worry there is no cracking ;).
Psi is opensource and I just sniffed my own traffic (reversing means to make something in the other direction or bether to say to reconstruct something ;)).
If you debug something you are reversing your own code for example ;).

My send gives me 0 and the recv recieves nothing.

clive

Well you might want to use shutdown() to tie up and flush the socket connection, and iterate on the recv(), before using closesocket().
It could be a random act of randomness. Those happen a lot as well.

justnew

Quote from: clive on November 28, 2010, 02:09:35 PM
Well you might want to use shutdown() to tie up and flush the socket connection, and iterate on the recv(), before using closesocket().
Thank you but my problem is at the send()...
I don't know why it just sends 0 bytes instead of the 140 (or so)...

clive

Then perhaps you aren't opening the socket right, or using the wrong socket/handle, or the application isn't enable in the firewall. But you don't provide a standalone/complete example to work with, so we're all left to guess what's screwed up.

Thing is, with TCP stuff doesn't always leave immediately when you send() small packets, it might also error.
It could be a random act of randomness. Those happen a lot as well.

Farabi

Have you init the socket? You will need to wait before the socket is connected.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

justnew

Sorry that I didn't write so long.
I initialised the Socket ans the WSA too.
Thank you for help I will check if the handle is the same I get at the startup.
I hope that I'm just overwriting the sockethandle...