97 end; |
97 end; |
98 |
98 |
99 procedure InitIPC; |
99 procedure InitIPC; |
100 var ipaddr: TIPAddress; |
100 var ipaddr: TIPAddress; |
101 begin |
101 begin |
102 WriteToConsole('Init SDL_Net... '); |
102 WriteToConsole('Init SDL_Net... '); |
103 SDLTry(SDLNet_Init = 0, true); |
103 SDLTry(SDLNet_Init = 0, true); |
104 fds:= SDLNet_AllocSocketSet(1); |
104 fds:= SDLNet_AllocSocketSet(1); |
105 SDLTry(fds <> nil, true); |
105 SDLTry(fds <> nil, true); |
106 WriteLnToConsole(msgOK); |
106 WriteLnToConsole(msgOK); |
107 WriteToConsole('Establishing IPC connection... '); |
107 WriteToConsole('Establishing IPC connection to tcp 127.0.0.1:' + IntToStr(ipcPort)); |
108 {$HINTS OFF} |
108 {$HINTS OFF} |
109 SDLTry(SDLNet_ResolveHost(ipaddr, '127.0.0.1', ipcPort) = 0, true); |
109 SDLTry(SDLNet_ResolveHost(ipaddr, '127.0.0.1', ipcPort) = 0, true); |
110 {$HINTS ON} |
110 {$HINTS ON} |
111 IPCSock:= SDLNet_TCP_Open(ipaddr); |
111 IPCSock:= SDLNet_TCP_Open(ipaddr); |
112 SDLTry(IPCSock <> nil, true); |
112 SDLTry(IPCSock <> nil, true); |
113 WriteLnToConsole(msgOK) |
113 WriteLnToConsole(msgOK) |
114 end; |
114 end; |
115 |
115 |
116 procedure CloseIPC; |
116 procedure CloseIPC; |
117 begin |
117 begin |
118 SDLNet_FreeSocketSet(fds); |
118 SDLNet_FreeSocketSet(fds); |