Erik. Posted April 26, 2010 Posted April 26, 2010 (edited) Hello, I wanted to listen to an port, like msn port 1863. I tried to use TCP listen, accept, port scan etc. I can not get it working. When i try to use tcp resv i got the erorr 0. Or i thought 10061. Could you please help me to got the listen working. Kind regards., Erik edit: Example: ;SERVER!! Start Me First !!!!!!!!!!!!!!! $g_IP = "127.0.0.1" ; Start The TCP Services ;============================================== TCPStartUp() ; Create a Listening "SOCKET" ;============================================== $MainSocket = TCPListen($g_IP, 1863, 100 ) If $MainSocket = -1 Then Exit It looks like that TCP accept gives the error, for example the program wireshark that can also listen to the ports. I already found out to use wincap. Edited April 26, 2010 by Erik. I little problem, hard to find and fix
Andreik Posted April 26, 2010 Posted April 26, 2010 Try this code: TCPStartup() $SERVER = TCPListen("127.0.0.1",1863) If @error Then MsgBox(0,"Error",@error) Exit EndIf While True Do $SOCKET = TCPAccept($SERVER) Sleep(10) Until $SOCKET <> -1 TrayTip("Connected","Someone connect to server.",3) While True $RECV = TCPRecv($SOCKET,512) If $RECV = "Hello" Then TCPSend($SOCKET,"The server receive your message.") Sleep(10) WEnd Sleep(10) WEnd You just use an universal client to connect and say Hello to server and if server started correctly should work.
Erik. Posted April 26, 2010 Author Posted April 26, 2010 Hi, Thanks for the fast response. The program is only running this part: Do $SOCKET = TCPAccept($SERVER) Sleep(10) Until $SOCKET <> -1 I little problem, hard to find and fix
Andreik Posted April 26, 2010 Posted April 26, 2010 Hi, Thanks for the fast response. The program is only running this part: Do $SOCKET = TCPAccept($SERVER) Sleep(10) Until $SOCKET <> -1 Until you connect to server and then run second loop with data received from client.
Erik. Posted April 26, 2010 Author Posted April 26, 2010 I understand. What i am trying is to make an package sniffer so i can see all packages that are coming in on a port. Is this the correct way or do i need to find another way to do that? I little problem, hard to find and fix
Andreik Posted April 26, 2010 Posted April 26, 2010 (edited) Check this and this. Edited April 26, 2010 by Andreik
Erik. Posted April 26, 2010 Author Posted April 26, 2010 I already found the first link, second one is new for me, does not work but i will try it. Thank you:) I little problem, hard to find and fix
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