Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
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 regular
 
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 online now   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 online now   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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How to change IP Address to reflect US IP hgiordanelli OS X 17 Dec 29, 2012 11:12 AM
How to supercharge Mini? ranny2 Mac mini 18 Oct 27, 2011 08:53 PM
How To Remove Server Part Of Lion? hhaydenn iMac 2 Aug 18, 2011 05:21 PM
Cydia's Manage Account Feature: How to change email address? johnnyxhuynh Jailbreaks and iOS Hacks 1 Mar 24, 2011 04:51 AM
How to change IP address? 66217 Mac Basics and Help 9 Jun 8, 2007 12:27 AM


All times are GMT -5. The time now is 04:54 AM.

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

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