Hello:
How can I build a Chat in mode consola with masm32?
Please help me.
Thank, Richard.
Do you mean a chat program in the console ?
Maybe start with http://www.jamesladdcode.com and make a plugin ?
Thank, but fastutil.exe no found :( and I don´t undertand good the code.
colaborame please. :U
Thank.
???? :(
Richard - look in the masm32 package for examples of console programs :wink
Then search the internet for winsock programs - you can even find chat programs :U
You can't hope to understand the code immediately, you need to learn first :bdg
Keep trying and we'll help you :8)
:U Thank Tedd.
Now, I have the server but the client no found :(
This is the code:
;Inicializa el DLL WindSock v1.1
invoke WSAStartup,0101h,ADDR wsaData
invoke socket,AF_INET,SOCK_STREAM,0
mov s1,eax
mov ax,AF_INET
mov sin1.sin_family,ax
invoke htons,Port
mov sin1.sin_port,ax
mov AdressIP, input("IP:")
invoke inet_addr, addr AdressIP >>>>>>>>>>>>>>>> No fount, why?
mov sin1.sin_addr,eax >>>>>>>>>>>>>>>> No fount
cmp eax,INADDR_NONE
print chr$("***Control paso 1***",13,10)
je errorIP2
cmp eax,SOCKET_ERROR
print chr$("***Control paso 2*** ",13,10)
je errorIP
jne conexion
ret
conexion:
;invoke socket,AF_INET,SOCK_STREAM,0
;mov s2,eax
invoke connect, s2, addr sin2, sizeof sin2
print chr$("paso 3 ",13,10)
cmp eax,SOCKET_ERROR
;cmp eax,INVALID_SOCKET
je conexion
jne enviar
ret
Hi,
I have made GUI chat pp I used for chatting between the systems on our school LAN while the teacher was not in the lab :bdg . I coded it while I was bored. It probably has lots of bugs. Try it. In server, select Connection-> Wait For Call. For client select COnnection-> Connect.
Thomas :U
[attachment deleted by admin]
This looks okay, but you have a few problems :wink
Quote from: Richard on June 01, 2005, 07:41:44 AM
mov AdressIP, input("IP:")
invoke inet_addr, addr AdressIP >>>>>>>>>>>>>>>> No fount, why?
mov sin1.sin_addr,eax >>>>>>>>>>>>>>>> No fount
cmp eax,INADDR_NONE
print chr$("***Control paso 1***",13,10)
je errorIP2
cmp eax,SOCKET_ERROR
print chr$("***Control paso 2*** ",13,10)
je errorIP
"print" is not one instruction, it's a function - it CAN change the flags AND the value of eax.
So when you do "je .." it's not the same because print changed the state of the zero/equal flag :wink
Try this..
.
.
mov sin1.sin_addr,eax
push eax
print chr$("***Control paso 1***",13,10)
pop eax
cmp eax,INADDR_NONE
je errorIP2
push eax
print chr$("***Control paso 2*** ",13,10)
pop eax
cmp eax,SOCKET_ERROR
je errorIP
.
.
Greetings:
Thank you very much Thomas :U
Thanks tedd :U
Either he forms the application following the suggestions, or envian the client as much as the servant. since I do so that when envie something to be able to receive it? Associate the application. Again thank you very much by all the offered aid
Richard.
[attachment deleted by admin]
Sorry, I don't understand what you mean :(
QuoteEither it forms the application following the suggestions, or sends the client as much as the server.
forms = 'informs/tells' or 'makes' ?
following = 'after' or 'copying' ?
suggestions = 'instructions' or 'signal' ?
sends the client as much as the server = as much as the server sends to the client? or as much as the server can receive?
Quotesince I do so that when send something to be able to receive it?
you want to know how to see when to receive?
you want to know how to see when to receive, and how receive, the receive of the program see error.
Thank you tedd. :U
¿Querés que probemos en español, y yo traduzco? :wink
Gracias QvasiModo :U
Como configuro la aplicación cliente - servidor, para que cuando el cliente envie, el servidor reciba y viceversa y muestre por pantalla. Las funciones estan implementadas pero cuando uso
invoke recv,s1,edit,SIZEOF edit,0 me muestra error de sockect.
de nuevo muchas gracias.
Richard
Small correction :wink
.data?
edit db 512 dup (?)
.
.
invoke recv, s1,ADDR edit,SIZEOF edit, 0
When you call RECV, the program will wait until there is data. So if there is nothing, it will wait forever :bdg
You can't know when there will be data to receive :(
But you can change it so you don't wait forever:
mov eax,1
mov temp,eax
invoke ioctlsocket, s1,FIONBIO,ADDR temp
So the client (or server) does not know when there is data, you just have to look. If there is, then you will receive it, if not then you will not :wink
Hi,
You can used non-blocking sockets and watch for event FD_READ to see whether the socket is ready to be read from.
Thomas :U
Hi,
Thomas ¿example?
I don´t undertand.
Thank. :U
Richard.
Thomas means you can use WSAAsyncSelect so you don't have wait each time when you call recv - you will get a 'message' to tell you.
But for now, just keep it simple :wink
Quote from: Richard on June 02, 2005, 10:55:24 PM
Gracias QvasiModo :U
Como configuro la aplicación cliente - servidor, para que cuando el cliente envie, el servidor reciba y viceversa y muestre por pantalla. Las funciones estan implementadas pero cuando uso
invoke recv,s1,edit,SIZEOF edit,0 me muestra error de sockect.
de nuevo muchas gracias.
Richard
Translation:Quote
How do I configure the client - server application, so that when the client sends, the server receives and viscecersa, and output the data to screen? The functions are implemented but when I use:
invoke recv,s1,edit,SIZEOF edit,0
I get a socket error. Thank you very much again.
Creo que deberías usar esta línea (estoy suponiendo que "edit" es un arreglo de caracteres):
invoke recv,s1,ADDR edit,SIZEOF edit,0
De otra forma, MASM cree que "edit" es un puntero a DWORD y lo lee como tal. Seguramente querías pasarle a recv el puntero al buffer, no los primeros cuatro bytes del mismo. ;)
Salu2
Hey guys,
I know only 3 human languges out of which only one is useful here. Would you mind speaking in a language most people can understand :boohoo: :naughty: :naughty: :green :green :toothy :bdg
Thomas :U
Quote from: thomasantony on June 07, 2005, 03:35:45 AM
Hey guys,
I know only 3 human languges out of which only one is useful here. Would you mind speaking in a language most people can understand :boohoo: :naughty: :naughty: :green :green :toothy :bdg
Thomas :U
Qvasi's help is for Richard, not for you :P
Richard's english isn't perfect, so it's easier to get the point across using his language insted of english.
Don't worry, you're not missing out on anything :bdg
Hi,
I want to know how to see when to receive?
I want to know how receive?
With the examples I get a error when invoke recv,s1,ADDR edit,SIZEOF edit,0 :(
Please help me,
Thank. :U
Richard
Quote from: Richard on June 07, 2005, 02:35:20 PM
Hi,
I want to know how to see when to receive?
I want to know how receive?
With the examples I get a error when invoke recv,s1,ADDR edit,SIZEOF edit,0 :(
Please help me,
Thank. :U
Richard
I told you - you do not know
when.
If you recv but there is nothing, then it will wait until there is something.
If you get an error, then there is something wrong in a different place :wink
What is the error you have??
invoke recv,s2,ADDR RecBuff,SIZEOF RecBuff,0
cmp eax,SOCKET_ERROR
je errorecibe
The program jump to the error when cmp eax, SOCKECT_ERROR
@Thomas: Don't worry, when I post something I want you to read I'll do it in english ::) :bg
@Richard: Can we see the code where you create the socket?
QvasiModo gracias por ayudarme :U
Richard
[attachment deleted by admin]
I can't believe that someone objected to clear communication after all the ones and zeros we pass along here! I enjoyed seeing the Spanish, I'd guess it was, and even understood some of it! Especially the Gracias! I'm almost fluent in American-eze, understand most English, some Australian ... but I always enjoy seeing other languages! Frankly though, I just don't understand how those symbolic languages like Chinese work but they certainly have some beautiful characters!
Richard: I'm afraid you have many errors in the program. I think you need to read more about winsock programming to understand better :wink
What is the purpose of socket 's1' ?
s1 is a variable type socket. With the that it establishes the conexion initial.
s1 SOCKET ?
Hi Richard,
How did you define the buffer 'edit'? You should do something like the one below
.data?
edit db 255 dup(?) ; reserve 255 bytes for recieving the data. Also if you use recv directly, it will hang your program forever, Yu can also use the sleect function to wait for a specific time interval after which the program stops waiting for data. Read the winsock tutorial at
http://www.madwizard.org/
It will help you a lot
Thomas :U
Richard: it's obvious you don't really understand the code you have 'written.'
Using sockets is not very simple, but it is not that difficult when you understand how it works. But you do need to try before you can understand it - which means reading a little more than stealing from examples on the web.
I think you have had too much help, and are not really trying.
This thread should be closed.
Thank :U
I am studying winsock32 and socket´s.
thanks for the help, but now we need something
in console we are capturing something to send to the server, but when the program capture something, it send "@:"
the capture is in the line 149 of client.asm
in the zip ared the client and the server.
Thanks for all
[attachment deleted by admin]
You're getting confused when using ADDR :P
txtinput does not want ADDR :wink
siguenv:
.
.
invoke send,[s2],ADDR txtinput,SIZEOF txtinput,0
should be...
invoke lstrlen, txtinput
invoke send,[s2],txtinput,eax,0
Remember txtinput IS the address, so 'ADDR txtinput' means "the address of the address of the text"
This also means SIZEOF will not work - you need to see how long the string is (lstrlen)
There is a small 'error' in the server when it receives messages, but I'll leave you to work that one out :U
Tedd, thank you very much :U
Richard.
How clear the buffer when recive? :(
EXAMPLE
rec:Hello World
rec:whereWorld
rec:byere World
:bdg You found that bug :U
After the server does recv, you need to add 0 (zero) to the end of the string.
invoke recv .........
lea ecx,[recvBuff]
mov BYTE PTR [eax+ecx],0
But check if recv returned SOCKET_ERROR first :wink
Ok Tedd, thank. :U
Richard.