Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 4, 2007, 01:25 AM   #1
KenLin
macrumors newbie
 
Join Date: Jul 2007
How to change IP address via cocoa program/ other program

Dear All,
I want to change IP address via cocoa's API or other function.
Is anyone knows how to change IP in program?

Thanks!
Ken Lin in trouble
KenLin is offline   0 Reply With Quote
Old Jul 4, 2007, 01:26 AM   #2
janey
macrumors 603
 
janey's Avatar
 
Join Date: Dec 2002
Location: sunny los angeles
and why would you need to change an IP address?
__________________
iPad | 15" MacBook Pro | black (iPhone 3GS|MacBook) | Mac mini server
moof!

janey is offline   0 Reply With Quote
Old Jul 4, 2007, 01:42 AM   #3
KenLin
Thread Starter
macrumors newbie
 
Join Date: Jul 2007
Dear janey:
I want to write a program to change IP easier via cocoa.

Thanks,
Ken
KenLin is offline   0 Reply With Quote
Old Jul 4, 2007, 01:45 AM   #4
janey
macrumors 603
 
janey's Avatar
 
Join Date: Dec 2002
Location: sunny los angeles
Dear Ken,

My question is asking you why one would want to change an IP address in such a manner when there are so many things that factor into this that the end user does not have control over?

Thanks,
Jane
__________________
iPad | 15" MacBook Pro | black (iPhone 3GS|MacBook) | Mac mini server
moof!

janey is offline   0 Reply With Quote
Old Jul 4, 2007, 02:19 AM   #5
KenLin
Thread Starter
macrumors newbie
 
Join Date: Jul 2007
Dear Ken,

My question is asking you why one would want to change an IP address in such a manner when there are so many things that factor into this that the end user does not have control over?

Thanks,
Jane
_______
Dear Jane:
Because i want to write a wireless dongle program, and i need to change / specify dongle's host IP address.

Thanks
Ken
KenLin is offline   0 Reply With Quote
Old Jul 4, 2007, 10:42 AM   #6
blaster_boy
macrumors 6502
 
Join Date: Jan 2004
Location: Belgium
You could always do a shell out from your program to launch ifconfig with the required settings to change the ip address.
blaster_boy is offline   0 Reply With Quote
Old Jul 4, 2007, 08:30 PM   #7
lancestraz
macrumors 6502a
 
lancestraz's Avatar
 
Join Date: Nov 2005
Location: RI
You can do this in Terminal.
Code:
sudo ifconfig en1 inet 192.168.0.1
And I imagine you can run a shell script via cocoa.
lancestraz is offline   0 Reply With Quote
Old Jul 5, 2007, 12:44 AM   #8
KenLin
Thread Starter
macrumors newbie
 
Join Date: Jul 2007
Thanks: Jane, blaster_boy & lancestraz:

Yes, shell script can work.
Do u have any other method to change IP address? like API or other functions?

Ken
KenLin is offline   0 Reply With Quote
Old Jul 5, 2007, 03:35 AM   #9
Eraserhead
macrumors G4
 
Eraserhead's Avatar
 
Join Date: Nov 2005
Location: UK
Quote:
Originally Posted by lancestraz View Post
And I imagine you can run a shell script via cocoa.
Btw how do you do that?
Eraserhead is offline   0 Reply With Quote
Old Jul 5, 2007, 03:58 AM   #10
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by Eraserhead View Post
Btw how do you do that?
NSTask
robbieduncan is offline   0 Reply With Quote
Old Jul 5, 2007, 05:04 AM   #11
Eraserhead
macrumors G4
 
Eraserhead's Avatar
 
Join Date: Nov 2005
Location: UK
Quote:
Originally Posted by robbieduncan View Post
Thanks , not knowing this has led me to go via Applescript to do it , though it is a one-off usage so it's not a big deal.

Last edited by Eraserhead; Jul 5, 2007 at 06:00 AM. Reason: bad english
Eraserhead is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Looking for a program to change metadata for use with Apple TV (Windows 8) tjhilder Apple TV and Home Theater 5 Feb 10, 2014 04:24 PM
Cannot change Default opening program (not seen this particular problem) henrybarnett Mac Basics and Help 3 Apr 21, 2013 08:39 AM
Having trouble with Spotflux, an IP address changing program piatti Mac Applications and Mac App Store 2 Mar 4, 2013 09:33 AM
Is There A Simple Program or App that Resets or Changes My IP Address Frequently? Inframan Mac Applications and Mac App Store 7 Feb 8, 2013 06:36 AM
Can't change the default program for mp4's from my HP printer's software!! greyham28 OS X 4 Jul 17, 2012 09:38 AM

Forum Jump

All times are GMT -5. The time now is 06:38 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC