Sign in to follow this  
Followers 0
Jeremy_61

Instant MESSENGER

11 posts in this topic

Hello All!

I want to made a application who like to an Instant Messenger.

The gui is OK, but I don't know about the technic to use for send and receive messages.

UDP/TCP??

Can you explain me with examples this two fonctionnalities in the server and the client.

Thanks All.

Bye

Share this post


Link to post
Share on other sites



I would suggest UDP. UDP packets have less capabilities than TCP but are smaller, simpler and faster than TCPs.

We usually use UDP when we need small and fast packets that we don't care if they reach their destination (i.e. for an intranet application, for gaming etc). TCP ones are usually used when we have big packet size and not a high sending frequency.

If you are going to use your application over the Internet though, I would suggest TCP beyond any thinking.

Also do some research on the internet on this issue.

I.e.: http://www.windowsitpro.com/Article/Articl...0315/40315.html

Share this post


Link to post
Share on other sites

There is currently a project on Instant Messaging called AutoIt ITS

http://www.autoit-its.com/

Private message me and I will send you information and answer your questions.

Share this post


Link to post
Share on other sites

OK Thanks.

But can you give me autoit scripts examples and explications about your examples.

Thanks

Share this post


Link to post
Share on other sites

Please first read about TCP and UDP, and the native autoit functions. Study the design of my TCP Made Easy thread located here:

http://www.autoitscript.com/forum/index.ph...topic=18738&hl=

And review the server and client script released on ITS Forums. If you do not understand something past that part, then you may ask, I can only give you tools to help you, I cannot magically give you knowledge.

AutoIt Smith

Share this post


Link to post
Share on other sites

I cannot magically give you knowledge.

:P:lmao:

I always thought you could

Share this post


Link to post
Share on other sites

I cannot magically give you knowledge.

AutoIt Smith

he doesn't want knowledge, just 'explications'. i like that word. i'm going to use it from now on.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

explications

explications

explications

explications

Share this post


Link to post
Share on other sites

explications

explications

explications

explications

good job, i think the thread is now officially hijacked. :P [/jackassery]

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

@Everyone

*Laughs Out Loud*

Here is some general Information:

TCP Meaning (According to Dictionary.com):

http://dictionary.reference.com/search?q=t...trol%20protocol

transmission control protocol

<networking, protocol> (TCP) The most common transport layer

protocol used on Ethernet and the Internet. It was

developed by DARPA.

TCP is the connection-oriented protocol built on top of

Internet Protocol (IP) and is nearly always seen in the

combination TCP/IP (TCP over IP). It adds reliable

communication and flow-control and provides full-duplex,

process-to-process connections.

TCP is defined in STD 7 and RFC 793.

User Datagram Protocol is the other, connectionless,

protocol that runs on top of IP.

UDP Meaning(According to Dictionary.com):

http://dictionary.reference.com/search?q=u...gram%20protocol

user datagram protocol

<protocol> (UDP) Internet standard network layer,

transport layer and session layer protocols which

provide simple but unreliable datagram services. UDP is

defined in STD 6, RFC 768. It adds a checksum and

additional process-to-process addressing information [to

what?]. UDP is a connectionless protocol which, like TCP,

is layered on top of IP.

UDP neither guarantees delivery nor does it require a

connection. As a result it is lightweight and efficient, but

all error processing and retransmission must be taken care of

by the application program.

Examples in AutoIt:

TCP Client Example

Global $MainSocket
Local $MaxLength = 512; Maximum Length Of Text
Local $Port = 1000; Port Number
Local $Server = @IPAddress1; Server IpAddress
TCPStartup()
$MainSocket = TCPConnect($Server, $Port)
If $MainSocket = -1 Then Exit MsgBox(16, "Error", "Unable to connect.")
While 1
    $Data = TCPRecv($MainSocket, $MaxLength)
    If $Data = "~bye" Then
        MsgBox(16, "Session Ended", "Connection Terminated.")
        Exit
    ElseIf $Data <> "" Then
    ; Unconditional Receive
        MsgBox(0, "Received Packet", $Data)
    EndIf
WEnd
Func OnAutoItExit()
    If $MainSocket <> - 1 Then
        TCPSend($MainSocket, "~bye")
        TCPCloseSocket($MainSocket)
    EndIf
    TCPShutdown()
EndFunc  ;==>OnAutoItExit

TCP Server Example

Global $MainSocket = -1
Global $ConnectedSocket = -1
Local $MaxConnection = 1; Maximum Amount Of Concurrent Connections
Local $MaxLength = 512; Maximum Length Of String
Local $Port = 1000; Port Number
Local $Server = @IPAddress1; Server IpAddress
TCPStartup()
$MainSocket = TCPListen($Server, $Port)
If $MainSocket = -1 Then Exit MsgBox(16, "Error", "Unable to intialize socket.")
While 1
    $Data = TCPRecv($ConnectedSocket, $MaxLength)
    If $Data = "~bye" Then
        MsgBox(16, "Session Ended", "Connection Terminated.")
        Exit
    ElseIf $Data <> "" Then
    ; Unconditional Receive
        MsgBox(0, "Received Packet", $Data)
    EndIf
    If $ConnectedSocket = -1 Then 
        $ConnectedSocket = TCPAccept($MainSocket)
        If $ConnectedSocket <> -1 Then
        ; Someone Connected
            TCPSend($ConnectedSocket, "Connected!")
        EndIf
    EndIf
WEnd
Func OnAutoItExit()
    If $ConnectedSocket <> - 1 Then
        TCPSend($ConnectedSocket, "~bye")
        TCPCloseSocket($ConnectedSocket)
    EndIf
    If $MainSocket <> -1 Then TCPCloseSocket($MainSocket)
    TCPShutdown()
EndFunc  ;==>OnAutoItExit

UDP Server Example

Global $MainSocket
Local $MaxConnection = 1; Maximum Amount Of Concurrent Connections
Local $MaxLength = 512; Maximum Length Of String
Local $Port = 1000; Port Number
Local $Server = @IPAddress1; Server IpAddress
UDPStartup()
$MainSocket = UDPBind($Server, $Port)
If @Error <> 0 Then Exit MsgBox(16, "Error", "Unable to intialize socket.")
While 1
    $Data = UDPRecv($MainSocket, $MaxLength)
    If $Data = "~bye" Then
        MsgBox(16, "Session Ended", "Connection Terminated.")
        Exit
    ElseIf $Data <> "" Then
    ; Unconditional Receive
        MsgBox(0, "Received Packet", $Data)
    EndIf
WEnd
Func OnAutoItExit()
    UDPSend($MainSocket, "~bye")
    UDPCloseSocket($MainSocket)
    UDPShutdown()
EndFunc

UDP Client Example

Global $MainSocket
Local $MaxLength = 512; Maximum Length Of Text
Local $Port = 1000; Port Number
Local $Server = @IPAddress1; Server IpAddress
UDPStartup()
$MainSocket = UDPOpen($Server, $Port)
If @Error <> 0 Then Exit MsgBox(16, "Error", "Unable to connect.")
UDPSend($MainSocket, "Connected!")
While 1
    $Data = UDPRecv($MainSocket, $MaxLength)
    If $Data = "~bye" Then
        MsgBox(16, "Session Ended", "Connection Terminated.")
        Exit
    ElseIf $Data <> "" Then
    ; Unconditional Receive
        MsgBox(0, "Received Packet", $Data)
    EndIf
WEnd
Func OnAutoItExit()
    UDPSend($MainSocket, "~bye")
    UDPCloseSocket($MainSocket)
    UDPShutdown()
EndFunc

TCP/IP Introduction:

http://www.yale.edu/pclt/COMM/TCPIP.HTM

UDP Introduction:

http://www.networksorcery.com/enp/protocol/udp.htm

I hope you find this information useful.

AutoIt Smith

Share this post


Link to post
Share on other sites

@Everyone

*Laughs Out Loud*

I hope you find this information useful.

AutoIt Smith

you've instantly given me knowledge i would have had to have otherwise researched, as if by magic... I think this belies your previous modesty.

I cannot magically give you knowledge.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0