Jeremy_61 Posted December 18, 2005 Share Posted December 18, 2005 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 Link to comment Share on other sites More sharing options...
erebus Posted December 18, 2005 Share Posted December 18, 2005 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 Link to comment Share on other sites More sharing options...
themax90 Posted December 19, 2005 Share Posted December 19, 2005 There is currently a project on Instant Messaging called AutoIt ITShttp://www.autoit-its.com/Private message me and I will send you information and answer your questions. Link to comment Share on other sites More sharing options...
Jeremy_61 Posted December 19, 2005 Author Share Posted December 19, 2005 OK Thanks. But can you give me autoit scripts examples and explications about your examples. Thanks Link to comment Share on other sites More sharing options...
themax90 Posted December 19, 2005 Share Posted December 19, 2005 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 Link to comment Share on other sites More sharing options...
MrSpacely Posted December 19, 2005 Share Posted December 19, 2005 I cannot magically give you knowledge. I always thought you could Link to comment Share on other sites More sharing options...
seandisanti Posted December 20, 2005 Share Posted December 20, 2005 I cannot magically give you knowledge.AutoIt Smithhe doesn't want knowledge, just 'explications'. i like that word. i'm going to use it from now on. Link to comment Share on other sites More sharing options...
MrSpacely Posted December 20, 2005 Share Posted December 20, 2005 explications explications explications explications Link to comment Share on other sites More sharing options...
seandisanti Posted December 20, 2005 Share Posted December 20, 2005 explications explications explications explicationsgood job, i think the thread is now officially hijacked. [/jackassery] Link to comment Share on other sites More sharing options...
themax90 Posted December 20, 2005 Share Posted December 20, 2005 @Everyone*Laughs Out Loud*Here is some general Information:TCP Meaning (According to Dictionary.com):http://dictionary.reference.com/search?q=t...trol%20protocoltransmission control protocol<networking, protocol> (TCP) The most common transport layerprotocol used on Ethernet and the Internet. It wasdeveloped by DARPA.TCP is the connection-oriented protocol built on top ofInternet Protocol (IP) and is nearly always seen in thecombination TCP/IP (TCP over IP). It adds reliablecommunication 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%20protocoluser datagram protocol<protocol> (UDP) Internet standard network layer,transport layer and session layer protocols whichprovide simple but unreliable datagram services. UDP isdefined in STD 6, RFC 768. It adds a checksum andadditional process-to-process addressing information [towhat?]. UDP is a connectionless protocol which, like TCP,is layered on top of IP.UDP neither guarantees delivery nor does it require aconnection. As a result it is lightweight and efficient, butall error processing and retransmission must be taken care ofby the application program.Examples in AutoIt:TCP Client ExampleGlobal $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 ;==>OnAutoItExitTCP Server ExampleGlobal $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 ;==>OnAutoItExitUDP Server ExampleGlobal $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() EndFuncUDP Client ExampleGlobal $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() EndFuncTCP/IP Introduction:http://www.yale.edu/pclt/COMM/TCPIP.HTMUDP Introduction:http://www.networksorcery.com/enp/protocol/udp.htmI hope you find this information useful.AutoIt Smith Link to comment Share on other sites More sharing options...
seandisanti Posted December 20, 2005 Share Posted December 20, 2005 @Everyone*Laughs Out Loud*I hope you find this information useful.AutoIt Smithyou'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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now