Hi all guys
i am new to C# and .net stuff as i was working with C++ for many years
i want to know that is it possibhle that i can have an MDI Child Form on my main Form and want it to return me some data
like for example i have my main Form has a "settings" button
when i click on "settings" button it should show a small MDI child form which has all the settings and return some data (i'll take care of data but i dont know how to return through a form)
thnx in advance
Well...as far as 'returning' data from the Form, you can't do that as a "return" call because Forms are objects, so the constructor cannot have a return type, however you can have a method that will set a variable in another class (that is public) to the data you want to return ... You can call this method when the form is closing.
I am not entirely sure if you can achieve the 'small form INSIDE another form' without creating your own control. I am not sure how practical/possible this would be, but you can try 1 of the following: extend the Control class (to make a control) or override the OnPaint of a new Form. This way you can define where stuff goes, and what gets drawn onto the screen.
I have used this piece of code in the past, which worked great.
in my example frmA was an MDIchildform of the main (MDIparent)
frmA()
{
public int a=0;
private btn_click(blabla)
{
frmOptions options = new frmOptions(this);
dialog.ShowDialog();
if(dialog.DialogResult == DialogResult.Yes)
{
dosomethingwith(a);
}
else
{
donothingwith(a);
}
}
}
public partial class frmOptions : Form
{
frmA callingform = null;
public frmOptions(frmA x)
{
callingform = x;
}
private void dosomething()
{
callingform.a = value;
}
private void btnSaveSettings_click()
{
this.DialogResult = DialogResult.Yes;
}
private void btnCancelSettings_click()
{
this.DialogResult = DialogResult.No;
}
}
good luck
I have to make the program to where it outputs "You were born on (DD-MM-YYYY, these are the user inputs).
I have everything besides that..can anyone help?
Code:
import java.util.Scanner;
//This program does math
public class Final
{
public static void main(String []args)
{
Scanner in=new Scanner(System.in);
System.out.println("One last test");
System.out.print("Enter your birthday (mm/dd/yyyy): ");
String roar=in.nextLine();
int n1=Integer.parseInt(roar);
String date;
String month, day, year;
String ox=in.nextLine();
String[] s = ox.split("/");
for( String str : s);
System.out.println("You were born on"+day+month+year);
}
}
That is what i have so far, but i need to declare the day, month and year..can anyone help me?
Bump..need help please.
backdown said:
I have to make the program to where it outputs "You were born on (DD-MM-YYYY, these are the user inputs).
I have everything besides that..can anyone help?
Code:
import java.util.Scanner;
//This program does math
public class Final
{
public static void main(String []args)
{
Scanner in=new Scanner(System.in);
System.out.println("One last test");
System.out.print("Enter your birthday (mm/dd/yyyy): ");
String roar=in.nextLine();
int n1=Integer.parseInt(roar);
String date;
String month, day, year;
String ox=in.nextLine();
String[] s = ox.split("/");
for( String str : s);
System.out.println("You were born on"+day+month+year);
}
}
That is what i have so far, but i need to declare the day, month and year..can anyone help me?
Click to expand...
Click to collapse
On running your program it shows that you're Strings date, month, day, and year are not initialized. I'm not 100% as I never got far into java, but you should initialize them
Code:
String string = null;
String string = 0;)
once they are initialized it gives another error, basically that you're birthday input of mm/dd/yyyy isn't in the proper format to be an integer. I do not know how to fix that one. My knowledge of java is very basic but I have a feeling that should help you out somewhat.
An easier alternative to what you are trying to accomplish would be to ask the month day and year in separate prompts and assign them to plain integers.
I have a feeling you are doing this for a college class perhaps? I had to do one similar to this thats why I ask.
On another note, you might have better luck finding the help you need on a site that is more geared towards java programming (maybe stack overflow?)
I hope this helps.
Yes, it is my college class.
so far i got this :
Code:
import java.util.Scanner;
//This program does math
public class Final
{
public static void main(String []args)
{
Scanner in=new Scanner(System.in);
System.out.println("One last test");
System.out.print("Enter your birthday (mm/dd/yyyy): ");
String roar=in.nextLine();
int n1= roar;
String date;
String month, day, year;
String ox=in.nextLine();
String[] s = ox.split("/");
System.out.println("You were born on"+s[0]+s[1]+s[2]);
String str;
}
}
Hi all!
Since days I have a problem now. I have an app that manage Entries in a list A. If one of these entries End-Date is today I whant that entry to be shown in a second list B. This is checked when I return from the "addNewItem" Window so I use onNavigatedTo.
Code:
// Static Variables
public static ObservableCollection<Item> lstToday = new ObservableCollection<Item>();
public static ObservableCollection<Item> lstWeek = new ObservableCollection<Item>();
public static ObservableCollection<Item> lstAll = new ObservableCollection<Item>();
// Constructor
public MainPage()
{
InitializeComponent();
MessageBox.Show("Initialize Component");
lbToday.ItemsSource = lstToday;
lbWeek.ItemsSource = lstWeek;
lbAll.ItemsSource = lstAll;
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
DateTime currentDate = DateTime.Now;
foreach (Item item in lstAll)
{
if (item.endDate.ToString("yyyy'-'MM'-'dd").Equals(currentDate.ToString("yyyy'-'MM'-'dd")))
{
lstToday.Add(item);
MessageBox.Show("Item '" + item.name + "' added to Todaylist");
}
}
}
private void appBarNew_Click(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri(string.Format("/EditAddItem.xaml"), UriKind.Relative));
}
After that I get an "System.Diagnostics.Debugger.Break();" error that doesn't occur when I delete "lbToday.ItemsSource = lstToday;" to avoid the ListBox Binding.
With lbAll ist runs without any problems!
Can I bind the Listbox direct to the ObservableCollection in XAML=
I really don't know, whats to do. So do you?
It would make my day!
Thanks!
What is the exception message and stack trace when the exception is thrown? (you can browse the properties of the exception using visual studio).
Your code actually works for me (although I had to make some assumptions about what is in lstAll as you don't mention that, and you may have an error in the DataTemplate for the listbox for binding your Item class)
Things to try:
Have you tried it with non static observable collections?
Use binding assignments in the xaml rather than setting the itemssource directly (e.g. using a viewmodel). Then you can let the phone engine worry about when to do the assigments. If you do that don't forget to set the page's datacontext property.
Try it with simple collections of strings first (rather than binding an 'item' class) so you can check it's working without a datatemplate.
Hope you fix it.
Ian
For the begging,
I found out that the problem for 2-way is on the libaudio.so, than I downloaded the source code from the github of samsung aries.
I found the file AudioHardware.cpp as the main one.
I googled the web and found a same file with 2-way and there is the code which do that
Code:
//wxj add for voice recorder
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <poll.h>
//wxj add end
Code:
//-------------- wxj add for voice recorder ----------------
#if RECORDER_MOMEM
/*
AT^DAUDREC=<ON/OFF>
<ON/OFF> 0 turn off record
1 turn on record
*/
#define MODEM_RECORD_INCALL_ON "at+audr=1\r"
#define MODEM_RECORD_INCALL_OFF "at+audr=0\r"
//define pty device for send at command
#define AUDIO_AT_PATH "/dev/ttymux4"
#define AUDIO_DATA_PATH "/dev/ttymux4"
#define NUM_ELEMS(a) (sizeof (a) / sizeof (a)[0])
static const char * s_finalResponsesError[] = {
"ERROR",
"+CMS ERROR:",
"+CME ERROR:",
};
/**
* returns 1 if line is a final response indicating success
* See 27.007 annex B
* WARNING: NO CARRIER and others are sometimes unsolicited
*/
static const char * s_finalResponsesSuccess[] = {
"OK",
};
static Mutex audioLockMutex;
static int isFinalResponseError(const char *line)
{
size_t i;
for (i = 0 ; i < NUM_ELEMS(s_finalResponsesError) ; i++) {
if (strcasestr(line, s_finalResponsesError[i])) {
return 1;
}
}
return 0;
}
static int isFinalResponseSuccess(const char *line)
{
size_t i;
for (i = 0 ; i < NUM_ELEMS(s_finalResponsesSuccess) ; i++) {
if (strcasestr(line, s_finalResponsesSuccess[i])) {
return 1;
}
}
return 0;
}
/**
* returns 1 if line is a final response, either error or success
* See 27.007 annex B
* WARNING: NO CARRIER and others are sometimes unsolicited
*/
static int isFinalResponse(const char *line)
{
return isFinalResponseSuccess(line) || isFinalResponseError(line);
}
static int s_fd = -1;
static int WriteATCommand(const char *s)
{
AutoMutex lock(audioLockMutex);
//int s_fd = open(AUDIO_AT_PATH,O_RDWR | O_NONBLOCK);
if ( s_fd < 0 ) {
LOGE(" AudioHardware ERROR OPEN AT interface, errno = %d ,s_fd = %d",errno,s_fd);
return -3;
}
size_t cur = 0;
size_t len = strlen(s);
ssize_t written;
LOGV(" AudioHardware AT> %s\n", s);
/* the main string */
while (cur < len) {
do {
written = write (s_fd, s + cur, len - cur);
} while (written < 0 && errno == EINTR);
if (written < 0) {
LOGE("AudioHardware write str error, errno = %d ",errno);
close(s_fd);
s_fd = 0;
return -1;
}
cur += written;
}
#if 0
/* the \r */
do {
written = write (s_fd, "\r" , 1);
} while ((written < 0 && errno == EINTR));
if (written < 0) {
LOGE(" AudioHardware write r error, errno = %d ",errno);
close(s_fd);
s_fd = 0;
return -1;
}
#endif
const int buf_len = 1024;
int readLen = 0, count = 0;
char* buffer = new char[buf_len];
//buffer[0] = '\0';
memset((void*)buffer, 0, buf_len);
bool final = false;
int tryTimes = 0;
int pollResult = 0;
for(;;){
while (0 == pollResult){
struct pollfd fpolls;
fpolls.fd = s_fd;
fpolls.events = POLLIN;
fpolls.revents = 0;
pollResult = poll(&fpolls, 1, 1000); //timeout 5 seconds
//data ready to be read
if (pollResult > 0 && POLLIN == fpolls.revents ){
LOGD(" AudioHardware data is available %d \n",__LINE__);
break;
}else if (pollResult < 0){
LOGD(" AudioHardware pollResult < 0 %d \n",__LINE__);
if (errno == EINTR){
continue;
}else{
break;
}
}else{
LOGE("timeout, but no data available");
if (tryTimes < 5){
tryTimes++;
}else{
LOGE("timeout, exit this command ");
delete []buffer;
close(s_fd);
s_fd = 0;
return -1;
}
}
}
do {
readLen = read (s_fd, buffer + count, buf_len - count);
} while ((readLen < 0 && errno == EINTR));
if (readLen > 0){
count += readLen;
}
if (isFinalResponse(buffer)){
final = true;
LOGD("at result=%s", buffer);
break;
}
tryTimes++;
if (tryTimes > 5){
break;
}
}
LOGV("AudioHardware AT>%s sucess", s);
delete []buffer;
//close(s_fd);
return 0;
}
#endif
//----------------- wxj add end for voice recorder -----------
I don't have linux or other way to compile the files, and I wish someone with more experience from me will compile it and I'm sure we will fine volunteers to test that.
the full cpp files are attached.
By the way, the lib file will be good even to the other ICS roms which based on samsung aries of CM
would be really cool to have that possibilty in more roms, so thx to come up with that and hopefully some dev has the time and knowledge to do this...
sry that i can't help you myself!
greetz,
sUsH
What model does this AudioHardware relate to? If this is related to MSMxxxx audio hardware, probably this will not work in any way. DEAR DEVELOPERS, can you help to continue this work to finally implement this feature? I think that we can start collecting dotations in order to make everybody involved in this project!!
I wish good luck and say THANKS to OP and all people who is able to help in any way!! I hope that this project will not stop and finally we add this so useful feature to our beloving Galaxy.
I'm afraid it does belong to msm, but even if not, there must be a way based on that, for just changing the code.
I can't find the source again but I think it was belong to defy
it IS definitely possible on our sgs, cause i remember some miui-rom i once flashed and used for a while, and with this rom two-way-call-recording was possible, meaning while in call i could just press the record-button and the call (both the caller and me) got recorded.
don't know if it was some dirty hack but it worked, i recorded plenty of calls with this rom. even automatic call recording was possible, so that everytime i got a call, it got recorded automagically.
if this is of interest, i could search for that specific miui-rom in my rom-archive.
greetz,
sUsH
sUsH667 said:
it IS definitely possible on our sgs, cause i remember some miui-rom i once flashed and used for a while, and with this rom two-way-call-recording was possible, meaning while in call i could just press the record-button and the call (both the caller and me) got recorded.
don't know if it was some dirty hack but it worked, i recorded plenty of calls with this rom. even automatic call recording was possible, so that everytime i got a call, it got recorded automagically.
if this is of interest, i could search for that specific miui-rom in my rom-archive.
greetz,
sUsH
Click to expand...
Click to collapse
Afaik, 2 way recording wasn't implemented on cm7/miui like ever. It was illegal and a dirty hack to.
Sent from my GT-I9000 using xda premium
siky_dude said:
It was illegal and a dirty hack to.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
But remember that not in every country...
hmm, are you sure? i really have that in my mind.
well, i'll look through my rom-history and see which one i think it was, maybe i am wrong...
Rausio said:
But remember that not in every country...
Click to expand...
Click to collapse
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
siky_dude said:
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
it is legal in every country... the issue in USA is that the recorder partner should tell the other side that the conversation is recorded, for example in Israel, just one side should know that the conversation is under recording, to prevent illegal bugging.
and it's not creepy we should record conversation for a lot of reason, even for people who are on ways all time and want to remember the conversation issue, or even when we argument with the cellular/internet providers.
It was working fine on froyo:
http://forum.xda-developers.com/showthread.php?t=967297
And stayed as project on gingerbread:
http://forum.xda-developers.com/showthread.php?t=1089425
Guys, let's stop offtopic discussing how legal is call recording or not, and also is it useful feature or useless; it is being discussed in other threads many times.
And the project on gingerbread trying to modify existing libraries probably ended with no success after trying all possible things, so we have to follow this way meaning developing the missing code, and i think now it is the only right way.
P.S. Probably this code also relates to call recording:
Code:
#if RECORDER_MOMEM
if(devices == AudioSystem::DEVICE_IN_VOICE_CALL) {
LOGV("set begin recording voice ");
mDevices = devices;
mVoiceRecorderFD = ::open(AUDIO_DATA_PATH,O_RDWR | O_NONBLOCK);
int i = 0;
while(mVoiceRecorderFD < 0) {
i++;
LOGV("AudioStreamInALSA::set i = %d ",i);
usleep(5000);
mVoiceRecorderFD = ::open(AUDIO_DATA_PATH,O_RDWR | O_NONBLOCK);
if(i > 20) {
LOGE(" AudioStreamInALSA::setDevice open muxaudio failure ",i);
return NO_INIT;
}
}
s_fd = mVoiceRecorderFD;
WriteATCommand(MODEM_RECORD_INCALL_ON);
return NO_ERROR;
}
#endif
l2tp, the code you brought here, seems to be related to ALSA (our galaxy) and is not related to the one I brought.
It's seems to be better chance.
Hey guys, did anybody try to do something on this?
Let's not give up!
siky_dude said:
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
Disabling camera shutter sound is also illegal for some countries. But you can disable it on Cyanogenmod settings. It just warns you about legality.
I have the coding skills but not the time to fully do this. I just thought I'd post and offer to assist if anyone wants to lead the project.
Plz do not give up!!
l2tp said:
Hey guys, did anybody try to do something on this?
Let's not give up!
Click to expand...
Click to collapse
I have also been waiting for this ever since I lost the feature after moving from Froyo to GB. :crying: It was a wonderful feature which eradicated the need for keeping a pen and paper ready for long office conference calls, specially when on the road. I was using some automatic recording script with customizable file naming convention and was in bliss!
In terms of legality, please let's keep that out of the equation as already pointed out with the camera shutter analogy. :silly:
The way I saw it, the legality thing was brought into picture by the MIUI 'porting' teams after the Froyo -> GB upgrade and instead of trying to 'fix' it, the questionable legality argument got presented.
Frankly, since the hardware supports it, it is only a question of finding and tweaking the correct sources. I do not have access to a compiler at the moment, but if someone needs help with code-reading/ review, please continue posting here or on pastebin. :fingers-crossed:
+1 this would be awesome!
2 way call recording is very important for me. Still using Darky 9.5 (Froyo) because of that, but I would like to try a GB or ICS ROM if a patch was available.
I'm developing a WP7 app, working alongside a Windows (server) application. They are talking with each other using sockets.
As soon as the WP7 app opens, I wish to perform a network scan to find the server application.
I already found out how to get the IP address of the WP7. So let's say I know the server should be somewhere at 192.168.0.*. How do I go about scanning this network?
I tried many things, the last of which is the code below. The problem here is that somehow the TIMEOUT_MILLISECONDS parameter seems to be like playing roulette (tried everything in the range of 100-2000 with different success). In addition, if I sweep the whole subnet like in the code below the phone cannot seem to handle the work. I only get it to work if I set the timeout to 2000 (which is way to long) and by scanning up to 5 IP's in the for-loop, instead of the whole subnet.
Is there anyone that knows a better and much more efficient(!) way to do this?
Code:
string thisIP = "192.168.0.101"; // I normally get this from some other function
string[] arrIP = thisIP.ToString().Split('.');
string IPBase = arrIP[0] + "." + arrIP[1] + "." + arrIP[2] + ".";
//MessageBox.Show(address.ToString());
for (int i = 2; i < 254; i++) {
string IP = IPBase + i;
CheckConnection CheckConn = new CheckConnection();
string resultConnect = CheckConn.Connect(IP, int.Parse(Resource1.port));
if (resultConnect == "Success") {
CheckConn.Send("isAlive");
string result = CheckConn.Receive();
if (result.Contains("yes")) {
// We have found the server
break;
}
}
CheckConn.Close();
}
Code:
public class CheckConnection
{
// Cached Socket object that will be used by each call for the lifetime of this class
Socket _socket = null;
static ManualResetEvent _clientDone = new ManualResetEvent(false);
const int TIMEOUT_MILLISECONDS = 100;
const int MAX_BUFFER_SIZE = 2048;
public string Connect(string hostName, int portNumber) {
string result = string.Empty;
DnsEndPoint hostEntry = new DnsEndPoint(hostName, portNumber);
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = hostEntry;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
result = e.SocketError.ToString();
_clientDone.Set();
});
_clientDone.Reset();
_socket.ConnectAsync(socketEventArg);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
return result;
}
public string Send(string data) {
string response = "Operation Timeout";
if (_socket != null) {
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.UserToken = null;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
response = e.SocketError.ToString();
_clientDone.Set();
});
byte[] payload = Encoding.UTF8.GetBytes(data);
socketEventArg.SetBuffer(payload, 0, payload.Length);
_clientDone.Reset();
_socket.SendAsync(socketEventArg);
// Block the UI thread for a maximum of TIMEOUT_MILLISECONDS seconds.
// If no response comes back within this time then proceed
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else {
response = "Socket is not initialized";
}
return response;
}
public string Receive() {
string response = "Operation Timeout";
if (_socket != null) {
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
if (e.SocketError == SocketError.Success) {
response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
response = response.Trim('\0');
}
else {
response = e.SocketError.ToString();
}
_clientDone.Set();
});
_clientDone.Reset();
_socket.ReceiveAsync(socketEventArg);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else {
response = "Socket is not initialized";
}
return response;
}
public void Close() {
if (_socket != null) {
_socket.Close();
}
}
}
Why you don't know the server IP?
I can't help you with your subnet scanning problem, don't have experience with that corner of WP7 programming.
But I do wonder what kind of arrangement leads to the problem that your app does not know the server address and therefore has to scan for it. Is neither a fixed IP available for your server nor some kind of DNS service up to tell you the current IP?
Even if there are multiple servers running and the phone has the job to somehow decide which one of those is responsible for it, you still could set up some kind of super-server that the phones could ask first which server they should address.
In any way, phones scanning subnets to find servers as some routine app startup action is a bad idea, if you ask me.
Please note that by 'server' I'm just revering to a software that accepts socket connections. This software is installed into a Windows computer that most likely has it's IP from DHCP.
The server software itself could present it's IP address so the end-user can type this address into the client on their WP7. Nice for tech-savvy folks, but that's not how software should be designed in my opinion. People don't need to know what an IP address is and shouldn't be force into typing 'weird numbers'. Properly designed software just have to work instantly and developers (again in my opinion) need to take care of a good design and that includes making things plug-and-play where they can.
Take a look at 'PC Remote' and you will see the kind of easy plug-and-play experience I'm looking for.
Did you check broadcast?
I'm really not network guy, but from Googling I got the impression that people use broadcast instead of IP range scanning for such IP number discovery tasks, and there seems to be a way to do broadcast on WP7 (albeit only using some tricks / hardly documented functionalilty):
E.g. see this thread:
http://stackoverflow.com/questions/8533471/udp-broadcasting-in-windows-phone-7
Which links to this:
http://forums.create.msdn.com/forums/t/88975.aspx
This makes sense to me after reading that broadcast is also the method how a client finds its DHCP server - isn't that the exact same scenario like yours?
Did you already check this way of looking at the problem, or maybe rule it out already for some reason?
It's better if you use a multicast group to send/receive packages. I had way better experience with it than using the Broadcast IP.
You need to join the multicast group with the phone and with the server app. I know there are multicast classes but I found it easier and mor convient to implement it with a socket...
And after you found the server, I'd use a persistent tcp connection which should improve your network performance (udp and wp7 is sometimes really strange...)
Thanks rbrunner7 and chabun for your comments, I appreciate your input!
rbrunner7 said:
Did you already check this way of looking at the problem, or maybe rule it out already for some reason?
Click to expand...
Click to collapse
I did, briefly, but abandoned this path after reading about the physical network equipment (switches etc.) having the need to support broadcasting which might not always be the case.
Anyway, your mentioned post describes 'limited broadcasting', which might be exactly what I should be looking for. Hopefully hardware limitations will not be applicable; I will look into this method further and will let you know how it works out!
roady001 said:
the physical network equipment (switches etc.) having the need to support broadcasting which might not always be the case.
Click to expand...
Click to collapse
I had the same doubts about that as it's also the case for multicasting. Most modern equipement supports it though and you can always provide the possibility to manually enter the server ip if you can't discover one via multicast/broadcast