Re: Help porting UNIX Socket Based App

From: thatsalok (thatsalok_at_NOSPAM.gmail.com.REMOVE)
Date: 02/23/05


Date: Wed, 23 Feb 2005 22:00:07 +0530


//here is basic Socket code which is compitable with Windows
//now you have to modify that accroding to your need

 int gaim_remote_session_connect(int session)
 {
 SOCKET fd;
  stored_uid, euid;
  struct sockaddr_in saddr;

  if ((fd = socket(AF_INET,SOCK_STREAM, 0)) != -1)
  {
 saddr.in_family=AF_INET;
 saddr.sin_port=ntol(4000);//change to actual port
 saddr.sin_addr.s_addr=inet_addr("");//give the remote ip here
           if (connect(fd, (struct sockaddr *) &saddr, sizeof (saddr))
!= -1) return fd; } close(fd); return -1; }i think i have ported
almost 70% of your unix code rest your have to port your self
With Regard'sAlok Guptavisit me at http://alok.bizhat.com
"Jim Jones" <jim@pleaseremovethisalongwithdash-qtextender.com> wrote in
message news:OQJ1OvaGFHA.3608@TK2MSFTNGP14.phx.gbl...
> What is your suggested changes in order to port the following code segment
> to the Windows platform? AF_UNIX? I don't understand these definitions.
>
> int
> gaim_remote_session_connect(int session)
> {
> gint fd;
> uid_t stored_uid, euid;
> struct sockaddr_un saddr;
>
> if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1)
> {
> saddr.sun_family = AF_UNIX;
> stored_uid = getuid();
> euid = geteuid();
> setuid(euid);
> sprintf(saddr.sun_path, "%s/gaim_%s.%d",
> g_get_tmp_dir(), g_get_user_name(), session);
> setreuid(stored_uid, euid);
>
> if (connect(fd, (struct sockaddr *) &saddr, sizeof (saddr)) != -1)
> return fd;
> }
>
> close(fd);
>
> return -1;
> }
>
>



Relevant Pages

  • Re: keeping ports open
    ... If a port is open, it means that 1) a software or service is running on your ... and 2) you're not using a firewall or your firewall isn't ... Use firewall software and hardware and antivirus software that is ... Follow the instructions for hardening Windows and IIS at ...
    (microsoft.public.security)
  • [Full-Disclosure] ron1n phone home, episode 4
    ... Hacking from Windows 3.x, 95 and NT ... Use secret Windows 95 DOS commands to track down and port surf computers ... Download hacker tools such as port scanners and password crackers designed ... Now you have the option of eight TCP/IP utilities to play with: telnet, ...
    (Full-Disclosure)
  • Re: How to Maintain an IIS Server?
    ... > server running on a Windows 2000 server. ... before a firewall and antivirus have been installed]. ... open ports; however, this will not identify which program is using the port. ...
    (microsoft.public.inetserver.iis.security)
  • Re: How to Maintain an IIS Server?
    ... >> server running on a Windows 2000 server. ... > before a firewall and antivirus have been installed]. ... > program or executable using that port. ...
    (microsoft.public.inetserver.iis.security)
  • RE: xp pro sharing printer
    ... How to troubleshoot network printing problems in Windows XP ... SMB-connected print server ... Incompatible print driver ... and then redirect the port to the network server. ...
    (microsoft.public.windowsxp.security_admin)