News:

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

Chat in mode consola

Started by Richard, May 25, 2005, 05:15:22 AM

Previous topic - Next topic

Richard

Hello:

How can I build a Chat in mode consola with masm32?
Please help me.

Thank, Richard.

James Ladd

Do you mean a chat program in the console ?
Maybe start with http://www.jamesladdcode.com and make a plugin ?

Richard

Thank, but fastutil.exe no found :( and  I don´t undertand good the code.

colaborame please. :U

Thank.

Richard


Tedd

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)
No snowflake in an avalanche feels responsible.

Richard

#5
 :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



thomasantony

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]
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

Tedd

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
    .
    .
No snowflake in an avalanche feels responsible.

Richard

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]

Tedd

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?
No snowflake in an avalanche feels responsible.

Richard

you want to know how to see when to receive, and how receive, the receive of the program see error.

Thank you tedd. :U

QvasiModo

¿Querés que probemos en español, y yo traduzco? :wink

Richard

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

Tedd

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
No snowflake in an avalanche feels responsible.

thomasantony

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
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free